This tool streamlines the process of packaging and uploading the PSADT folder to your Intune Tenant using .
After encountering repeated errors while repackaging and uploading the same .intunewin package, I realized it was time to automate the task. Leveraging the IntuneWin32App module by Nickolaj Andersen (an excellent resource, by the way), I developed a Powershell script to automate the packaging and uploading of .intunewin files to Intune.
I implemented a straightforward detection method—a file named AutoPackage.txt
in %ProgramData%
—and then thought, why not simplify it even further for my colleagues? To reduce manual input, I added two popup windows that allow you to select the App Name and Source Folder with just a few clicks.


Anyways here you can find the script or on my Github
##Function Get-Folder
Function Get-Folder($initialDirectory,$Type) {
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
$FolderBrowserDialog = New-Object System.Windows.Forms.FolderBrowserDialog
$FolderBrowserDialog.Description = $type
$FolderBrowserDialog.RootFolder = 'MyComputer'
# open window to select a Directory, starting with the value of .InitalDirectory
[void]$FolderBrowserDialog.ShowDialog()
# returns the value of the selected Path
return $FolderBrowserDialog.SelectedPath
}
##Function Get-DisplayName
Function Get-DisplayName {
[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
[Microsoft.VisualBasic.Interaction]::InputBox("Enter display Name","Display Name?")
}
$tenantID = "##Your Tenant ID xxx.microsoft.com"
Connect-MSIntuneGraph -ClientID ##Add your powershell App ID here -TenantID $tenantID
$Source = (Get-Folder -Type "Choose Source Folder")
$Output = "C:\windows\Temp"
$displayName = Get-DisplayName
$installCommandLine = 'Deploy-Application.exe -DeploymentType "Install"'
$uninstallCommandLine = 'Deploy-Application.exe -DeploymentType "Uninstall"'
$detection = New-IntuneWin32AppDetectionRuleFile -Existence -Path "C:\ProgramData" -FileOrFolder "AutoPackage.txt" -DetectionType exists
$IntuneWinFile = New-IntuneWin32AppPackage -SourceFolder $Source -OutputFolder $Output -SetupFile "Deploy-Application.exe" -Force
Rename-Item -Path ($IntuneWinFile.Path) -NewName "$displayName.intunewin"
$IntuneWinFile.FileName = $displayName
$newIntuneWinPath = (($IntuneWinFile.Path).Trim("Deploy-Application.intunewin"))+"$displayName.intunewin"
Add-IntuneWin32App -FilePath $newIntuneWinPath -DisplayName $displayName -Description "##Add yours" -Publisher "##Add yours" -InstallCommandLine $installCommandLine -UninstallCommandLine $uninstallCommandLine -InstallExperience system -RestartBehavior allow -DetectionRule $detection
P.S.: This works better with PowerShell 5. It works fine with PowerShell 7 if you edit the module. Also, don’t forget to customize the script with your variables.
Feel free to throw a comment if you have any questions! And while you’re here, don’t forget to check out my other (and only) post at the time of writing this post.