Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions that are not cross platform and won't run inside of Linux/Unix like OS #164

Open
aollivierre opened this issue Jun 9, 2024 · 0 comments

Comments

@aollivierre
Copy link

aollivierre commented Jun 9, 2024

  • New-IntuneWin32AppPackage.ps1 calls IntuneWinAppUtil.exe
  • Invoke-AzureCopyUtility.ps1 calls AzCopy.exe
  • New-IntuneWin32AppBody.ps1 calls msiexec.exe
  • etc..

all these functions and other functions that wraps around Win binaries will fail in Linux based OS and hence making the entire module non-usable in a cross-platform fashion and therefore rendering the module useless in DevOPS environments such as docker containers running Linux/Unix-like images.

Now for the first function the replacement for IntuneWinAppUtil.exe is https://www.powershellgallery.com/packages/SvRooij.ContentPrep.Cmdlet/0.1.4 which provides a native PS way to package a source folder as *.Intunewin file no issues you simply call it this way

function Create-IntuneWinPackage {
    param(
        [Parameter(Mandatory = $true)]
        [pscustomobject]$Prg,

        [Parameter(Mandatory = $true)]
        [string]$Prg_Path,

        [Parameter(Mandatory = $true)]
        [string]$destinationPath
    )
    try {
        Write-EnhancedLog -Message "Creating .intunewin package..." -Level "INFO" -ForegroundColor ([ConsoleColor]::Cyan)

        $setupFile = "install.ps1"
        # $Win32AppPackage = New-IntuneWin32AppPackage -SourceFolder $Prg_Path -SetupFile $setupFile -OutputFolder $destinationPath -Verbose -Force:$true

        # using New-IntuneWinPackage instead of New-IntuneWin32AppPackage because it creates a .intunewin file in a cross-platform way both on Windows and Linux
        New-IntuneWinPackage -SourcePath $Prg_Path -DestinationPath $destinationPath -SetupFile $setupFile -Verbose
        # Write-Host "Package creation completed successfully." -ForegroundColor Green
        Write-EnhancedLog -Message "Package creation completed successfully." -Level "INFO" -ForegroundColor ([ConsoleColor]::Green)

        $IntuneWinFile = Join-Path -Path $destinationPath -ChildPath "install.intunewin"
        
        # $IntuneWinFile = $Win32AppPackage.Path
        Write-EnhancedLog -Message "IntuneWinFile path set: $IntuneWinFile" -Level "INFO" -ForegroundColor ([ConsoleColor]::Green)
        return $IntuneWinFile
    }
    catch {
        Write-EnhancedLog -Message "Error creating .intunewin package: $_" -Level "ERROR" -ForegroundColor ([ConsoleColor]::Red)
        Write-Host "Error creating .intunewin package: $_" -ForegroundColor Red
        exit
    }
}

The other two

  • Invoke-AzureCopyUtility.ps1 calls AzCopy.exe (perhaps PowerShell AZ modules can replace that)
  • New-IntuneWin32AppBody.ps1 calls msiexec.exe
    I am not sure if there is a PS native alternative to them.

I'll try to look and see but I wanted you to be aware of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant