MSEndpointMgr / IntuneWin32App

Provides a set of functions to manage all aspects of Win32 apps in Microsoft Intune.
MIT License
343 stars 88 forks source link

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

Open aollivierre opened 3 months ago

aollivierre commented 3 months ago

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

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