Sample_InvokeConfiguration.ps1 (784B)
1 <# 2 .SYNOPSIS 3 Performs a WinGet Configuration and synchronously wait for its completion. 4 Use Invoke-WinGetConfiguration to perform a WinGet Configuration. 5 #> 6 7 param ( 8 [Parameter(Mandatory)] 9 $configFile 10 ) 11 12 if (-not(Get-Module -Name Microsoft.WinGet.Configuration -ListAvailable)) 13 { 14 Install-Module Microsoft.WinGet.Configuration -AllowPrerelease 15 } 16 17 Import-Module Microsoft.WinGet.Configuration 18 19 $configSet = Get-WinGetConfiguration -File $configFile 20 21 # Calling this cmdlet is not required, but it will performed by Invoke/Start 22 # if not done before. 23 $configSet = Get-WinGetConfigurationDetails -Set $configSet 24 25 # Optionally pass -AcceptConfigurationAgreements to accept the agreements. 26 Invoke-WinGetConfiguration -Set $configSet