packagefactory
packagefactory copied to clipboard
Update Create-Win32App.ps1
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.
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
}
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)
}