From 1312530870c00577567d483c4fb70fc9e4f1e264 Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Sun, 22 Sep 2024 18:28:29 +1000 Subject: [PATCH] Update New-Win32Package.ps1 Add support for installers already in intunewin format --- New-Win32Package.ps1 | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/New-Win32Package.ps1 b/New-Win32Package.ps1 index 381e6ade..d7214ef9 100644 --- a/New-Win32Package.ps1 +++ b/New-Win32Package.ps1 @@ -388,16 +388,22 @@ process { } # Create the intunewin package - $params = @{ - SourceFolder = $SourcePath - SetupFile = $IntuneWinSetupFile - OutputFolder = $OutputPath - Force = $true + if ($Result.FullName -match "\.intunewin$") { + Write-Msg -Msg "Copy downloaded intunewin file to: '$Path\output'" + Copy-Item -Path $Result.FullName -Destination $OutputPath -Force + } + else { + $params = @{ + SourceFolder = $SourcePath + SetupFile = $IntuneWinSetupFile + OutputFolder = $OutputPath + Force = $true + } + Write-Msg -Msg "Create intunewin package in: '$OutputPath'" + Write-Msg -Msg "Source folder: '$SourcePath'" + Write-Msg -Msg "Setup file: '$IntuneWinSetupFile'" + $IntuneWinPackage = New-IntuneWin32AppPackage @params } - Write-Msg -Msg "Create intunewin package in: '$OutputPath'" - Write-Msg -Msg "Source folder: '$SourcePath'" - Write-Msg -Msg "Setup file: '$IntuneWinSetupFile'" - $IntuneWinPackage = New-IntuneWin32AppPackage @params # Get the package file $PackageFile = Get-ChildItem -Path $OutputPath -Recurse -Include "*.intunewin" -ErrorAction "SilentlyContinue"