winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Sample_StartConfiguration.ps1 (700B)


      1 <#
      2     .SYNOPSIS
      3         Performs a WinGet Configuration asynchronously.
      4         Use Start-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 # Starts the configuration in the background
     20 $configJob = Get-WinGetConfiguration -File $configFile | Start-WinGetConfiguration
     21 
     22 # This will block until the configuration is completed. Or print the results if already done.
     23 Complete-WinGetConfiguration -ConfigurationJob $configJob