-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathupload-winget-app.ps1
41 lines (32 loc) · 1.58 KB
/
upload-winget-app.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Connect-MSIntuneGraph -Interactive -TenantID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# Get MSI meta data from .intunewin file
$IntuneWinFile = "C:\Tools\packages\Microsoft.AzureCLI\2.51.0\azure-cli-2.51.0.intunewin"
$IntuneWinMetaData = Get-IntuneWin32AppMetaData -FilePath $IntuneWinFile
# Create custom display name like 'Name' and 'Version'
$DisplayName = $IntuneWinMetaData.ApplicationInfo.Name + " " + $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductVersion
# Create MSI detection rule
$DetectionRuleArguments = @{
"ProductCode" = $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductCode
"ProductVersionOperator" = "greaterThanOrEqual"
"ProductVersion" = $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductVersion
}
$DetectionRule = New-IntuneWin32AppDetectionRuleMSI @DetectionRuleArguments
# Create operative system requirement rule
$RequirementRule = New-IntuneWin32AppRequirementRule -Architecture "All" -MinimumSupportedWindowsRelease "W10_1909"
# Create custom return code
$ReturnCode = New-IntuneWin32AppReturnCode -ReturnCode 1337 -Type retry
# Construct a table of default parameters for the Win32 app
$Win32AppArgs = @{
"FilePath" = $IntuneWinFile
"DisplayName" = $DisplayName
"Description" = "App description"
"Publisher" = "MSEndpointMgr"
"AppVersion" = $IntuneWinMetaData.ApplicationInfo.MsiInfo.MsiProductVersion
"InstallExperience" = "system"
"RestartBehavior" = "suppress"
"DetectionRule" = $DetectionRule
"RequirementRule" = $RequirementRule
"ReturnCode" = $ReturnCode
"Verbose" = $true
}
Add-IntuneWin32App @Win32AppArgs