packagefactory icon indicating copy to clipboard operation
packagefactory copied to clipboard

Update Create-Win32App.ps1

Open Constey opened this issue 10 months ago • 2 comments

changed that if detection via script is used, the detectionscript will be taken from the app direcotry instead of main\scripts path. So we have all files related to an app inside the app folder.

Constey avatar Jul 31 '23 10:07 Constey

in New-Win32Package.psm1 i've added Comparison of Version as [version] object to ensure correct handling of subversions.

$a = "5.15.5.19404" $b = "5.15.11.21032" [version]$a -gt [version]$b False <- correct $a -gt $b True <- wrong

elseif ([version]$Manifest.PackageInformation.Version -le [version]$ExistingApp.displayVersion) {
    Write-Msg -Msg "Existing Intune app version is current: '$($ExistingApp.displayVersion)'"
    Write-Output -InputObject $false
}
elseif ([version]$Manifest.PackageInformation.Version -gt [version]$ExistingApp.displayVersion) {
    Write-Msg -Msg "Import application version: '$($Manifest.Information.DisplayName)'"
    Write-Output -InputObject $true
}

Constey avatar Aug 31 '23 20:08 Constey

I've another fix for more stability when the icon file parameter is empty.


    # Icon file - download the file, if the property is a URL
    if ($AppData.PackageInformation.IconFile -match "^http") {
        $OutFile = [System.IO.Path]::Combine($PSScriptRoot, $(Split-Path -Path $AppData.PackageInformation.IconFile -Leaf))
        $params = @{
            Uri             = $AppData.PackageInformation.IconFile
            OutFile         = $OutFile
            UseBasicParsing = $True
        }
        Invoke-WebRequest @params
        $AppIconFile = $OutFile
    }
    else {
        # Only if file already exists
        if (Test-Path -Path $AppIconFile) {
            $AppIconFile = $AppData.PackageInformation.IconFile
        } else {
            $AppIconFile = $null
        }
        
    }

.....

    # Add icon if existing
    if (![string]::IsNullOrEmpty($AppIconFile)) {
        $Icon = New-IntuneWin32AppIcon -FilePath $AppIconFile
    }
.....

    if (![string]::IsNullOrEmpty($Icon)) {
        $Win32AppArgs.Add("Icon", $Icon)
    }

Constey avatar Sep 27 '23 15:09 Constey