winget-cli

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

Sample_InstallPackage.ps1 (778B)


      1 <#
      2     .SYNOPSIS
      3         Example for 'Install-WinGetPackage' cmdlet.
      4         Installs the specified application based on the provided arguments.
      5 #>
      6 
      7 # TODO: Replace parameter with actual module name from PSGallery once module is released. 
      8 Param (
      9     [Parameter(Mandatory)]
     10     $ModulePath
     11 )
     12 
     13 Import-Module -Name $ModulePath
     14 
     15 # Install a package by name
     16 Install-WinGetPackage -Name powertoys
     17 
     18 # Install a package by version and package identifier.
     19 Install-WinGetPackage -Id Microsoft.PowerToys -Version 0.15.2
     20 
     21 # Install a package from a specific source
     22 Install-WinGetPackage -Id Microsoft.PowerToys -Source winget
     23 
     24 # Install a package with a specific architecture and scope.
     25 Install-WinGetPackage -Id Microsoft.PowerToys -Architecture X64 -Scope User