Sample_MSI.ps1
Remove-Module -Name IntuneWin32App -Force # Import module Import-Module -Name C:\GoogleDrive\Scripts\PowerShell\Intune\Modules\IntuneWin32App\IntuneWin32App.psd1 # Get MSI meta data from .intunewin file $IntuneWinFile = "C:\Temp\IntuneWinAppUtil\Output\7z1900-x64.intunewin" $IntuneWinMetaData = Get-IntuneWin32AppMetaData -FilePath $IntuneWinFile $IntuneWinMetaData.ApplicationInfo.EncryptionInfo # Create custom display name like 'Name' and 'Version' $DisplayName = $IntuneWinMetaData.ApplicationInfo.Name + " " + $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductVersion # Create MSI detection rule $DetectionRule = New-IntuneWin32AppDetectionRule -MSI -MSIProductCode $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductCode # Create custom return code #$ReturnCode = New-IntuneWin32AppReturnCode -ReturnCode 1337 -Type retry # Add new MSI Win32 app $Win32App = Add-IntuneWin32App -TenantName configmgrse.onmicrosoft.com -FilePath $IntuneWinFile -DisplayName $DisplayName -InstallExperience system -RestartBehavior suppress -DetectionRule $DetectionRule -Verbose $Win32App # Add assignment to Win32 app #Add-IntuneWin32AppAssignment |