Install-WinGetPackage.md (13318B)
1 --- 2 external help file: Microsoft.WinGet.Client.Cmdlets.dll-Help.xml 3 Module Name: Microsoft.WinGet.Client 4 ms.date: 08/01/2024 5 online version: 6 schema: 2.0.0 7 title: Install-WinGetPackage 8 --- 9 10 # Install-WinGetPackage 11 12 ## SYNOPSIS 13 Installs a WinGet Package. 14 15 ## SYNTAX 16 17 ### FoundSet (Default) 18 19 ``` 20 Install-WinGetPackage [-Mode <PSPackageInstallMode>] [-Override <String>] [-Custom <String>] 21 [-Location <String>] [-Log <String>] [-Force] [-Header <String>] [-AllowHashMismatch] 22 [-Architecture <PSProcessorArchitecture>] [-InstallerType <PSPackageInstallerType>] [-Locale <String>] 23 [-Scope <PSPackageInstallScope>] [-SkipDependencies] [-Version <String>] [-Id <String>] [-Name <String>] 24 [-Moniker <String>] [-Source <String>] [[-Query] <String[]>] [-MatchOption <PSPackageFieldMatchOption>] 25 [-WhatIf] [-Confirm] [<CommonParameters>] 26 ``` 27 28 ### GivenSet 29 30 ``` 31 Install-WinGetPackage [-Mode <PSPackageInstallMode>] [-Override <String>] [-Custom <String>] 32 [-Location <String>] [-Log <String>] [-Force] [-Header <String>] [-AllowHashMismatch] 33 [-Architecture <PSProcessorArchitecture>] [-InstallerType <PSPackageInstallerType>] [-Locale <String>] 34 [-Scope <PSPackageInstallScope>] [-SkipDependencies] [[-PSCatalogPackage] <PSCatalogPackage>] 35 [-Version <String>] [-WhatIf] [-Confirm] [<CommonParameters>] 36 ``` 37 38 ## DESCRIPTION 39 40 This command installs a WinGet package from a configured source. The command includes parameters 41 to specify values used to search for packages in the configured sources. By default, the command 42 searches all sources. By default, all string-based searches are case-insensitive substring searches. 43 Wildcards are not supported. You can change the search behavior using the **MatchOption** parameter. 44 45 ## EXAMPLES 46 47 ### Example 1: Install a package using a query 48 49 ```powershell 50 Install-WinGetPackage Microsoft.PowerShell 51 ``` 52 53 This example show how to install a package using a query. The **Query** parameter is positional, so 54 you don't need to include the parameter name before the query string. 55 56 ### Example 2: Install a package by Id 57 58 ```powershell 59 Install-WinGetPackage -Id Microsoft.PowerShell 60 ``` 61 62 This example shows how to install a package by the specifying the package identifier. 63 If the package identifier is available from more than one source, you must provide additional search 64 criteria to select a specific instance of the package. 65 66 > **If more than one source is configured with the same package identifier, the user must disambiguate** 67 68 ### Example 3: Install a package by Name 69 70 ```powershell 71 Install-WinGetPackage -Name "PowerToys (Preview)" 72 ``` 73 74 This example shows how to install a package by specifying the package name. 75 76 ### Example 4: Install a specific version of a package 77 78 ```powershell 79 Install-WinGetPackage Microsoft.PowerShell -Version 7.4.4.0 80 ``` 81 82 This example shows how to install a specific version of a package using a query. The command does a 83 query search for packages matching `Microsoft.PowerShell`. The results of the search a limited to 84 matches with the version of `7.4.4.0`. 85 86 ## PARAMETERS 87 88 ### -AllowHashMismatch 89 90 Allows you to download package even when the SHA256 hash for an installer or a dependency does not 91 match the SHA256 hash in the WinGet package manifest. 92 93 ```yaml 94 Type: System.Management.Automation.SwitchParameter 95 Parameter Sets: (All) 96 Aliases: 97 98 Required: False 99 Position: Named 100 Default value: None 101 Accept pipeline input: True (ByPropertyName) 102 Accept wildcard characters: False 103 ``` 104 105 ### -Architecture 106 107 Specify the processor architecture for the WinGet package installer. 108 109 ```yaml 110 Type: Microsoft.WinGet.Client.PSObjects.PSProcessorArchitecture 111 Parameter Sets: (All) 112 Aliases: 113 Accepted values: Default, X86, Arm, X64, Arm64 114 115 Required: False 116 Position: Named 117 Default value: None 118 Accept pipeline input: True (ByPropertyName) 119 Accept wildcard characters: False 120 ``` 121 122 ### -Custom 123 124 Use this parameter to pass additional arguments to the installer. The parameter takes a single string value. To add multiple arguments, include the arguments in the string. The arguments must be provided in the format expected by the installer. If the string contains spaces, it must be enclosed in quotes. This string is added to the arguments defined in the package manifest. 125 126 ```yaml 127 Type: System.String 128 Parameter Sets: (All) 129 Aliases: 130 131 Required: False 132 Position: Named 133 Default value: None 134 Accept pipeline input: True (ByPropertyName) 135 Accept wildcard characters: False 136 ``` 137 138 ### -Force 139 140 Force the installer to run even when other checks WinGet would perform would prevent this action. 141 142 ```yaml 143 Type: System.Management.Automation.SwitchParameter 144 Parameter Sets: (All) 145 Aliases: 146 147 Required: False 148 Position: Named 149 Default value: None 150 Accept pipeline input: True (ByPropertyName) 151 Accept wildcard characters: False 152 ``` 153 154 ### -Header 155 156 Custom value to be passed via HTTP header to WinGet REST sources. 157 158 ```yaml 159 Type: System.String 160 Parameter Sets: (All) 161 Aliases: 162 163 Required: False 164 Position: Named 165 Default value: None 166 Accept pipeline input: True (ByPropertyName) 167 Accept wildcard characters: False 168 ``` 169 170 ### -Id 171 172 Specify the package identifier to search for. The command does a case-insensitive full text match, 173 rather than a substring match. 174 175 ```yaml 176 Type: System.String 177 Parameter Sets: FoundSet 178 Aliases: 179 180 Required: False 181 Position: Named 182 Default value: None 183 Accept pipeline input: True (ByPropertyName) 184 Accept wildcard characters: False 185 ``` 186 187 ### -InstallerType 188 189 A package may contain multiple installer types. Use this parameter to select the installer you want 190 to use. The parameter accepts the following values: 191 - `Default` 192 - `Inno` 193 - `Wix` 194 - `Msi` 195 - `Nullsoft` 196 - `Zip` 197 - `Msix` 198 - `Exe` 199 - `Burn` 200 - `MSStore` 201 - `Portable` 202 203 ```yaml 204 Type: Microsoft.WinGet.Client.PSObjects.PSPackageInstallerType 205 Parameter Sets: (All) 206 Aliases: 207 Accepted values: Default, Inno, Wix, Msi, Nullsoft, Zip, Msix, Exe, Burn, MSStore, Portable 208 209 Required: False 210 Position: Named 211 Default value: None 212 Accept pipeline input: True (ByPropertyName) 213 Accept wildcard characters: False 214 ``` 215 216 ### -Locale 217 218 Specify the locale of the installer package. The locale must provided in the BCP 47 format, such as 219 `en-US`. For more information, see 220 [Standard locale names](/globalization/locale/standard-locale-names). 221 222 ```yaml 223 Type: System.String 224 Parameter Sets: (All) 225 Aliases: 226 227 Required: False 228 Position: Named 229 Default value: None 230 Accept pipeline input: True (ByPropertyName) 231 Accept wildcard characters: False 232 ``` 233 234 ### -Location 235 236 Specify the file path where you want the packed to be installed. The installer must be able to 237 support alternate install locations. 238 239 ```yaml 240 Type: System.String 241 Parameter Sets: (All) 242 Aliases: 243 244 Required: False 245 Position: Named 246 Default value: None 247 Accept pipeline input: True (ByPropertyName) 248 Accept wildcard characters: False 249 ``` 250 251 ### -Log 252 253 Specify the location for the installer log. The value can be a fully-qualified or relative path and must include the file name. For example: `$env:TEMP\package.log`. 254 255 ```yaml 256 Type: System.String 257 Parameter Sets: (All) 258 Aliases: 259 260 Required: False 261 Position: Named 262 Default value: None 263 Accept pipeline input: True (ByPropertyName) 264 Accept wildcard characters: False 265 ``` 266 267 ### -MatchOption 268 269 Specify the match option for a WinGet package query. This parameter accepts the following values: 270 - `Equals` 271 - `EqualsCaseInsensitive` 272 - `StartsWithCaseInsensitive` 273 - `ContainsCaseInsensitive` 274 275 ```yaml 276 Type: Microsoft.WinGet.Client.PSObjects.PSPackageFieldMatchOption 277 Parameter Sets: FoundSet 278 Aliases: 279 Accepted values: Equals, EqualsCaseInsensitive, StartsWithCaseInsensitive, ContainsCaseInsensitive 280 281 Required: False 282 Position: Named 283 Default value: None 284 Accept pipeline input: True (ByPropertyName) 285 Accept wildcard characters: False 286 ``` 287 288 ### -Mode 289 290 Specify the output mode for the installer. The parameter accepts the following values: 291 - `Default` 292 - `Silent` 293 - `Interactive` 294 295 ```yaml 296 Type: Microsoft.WinGet.Client.PSObjects.PSPackageInstallMode 297 Parameter Sets: (All) 298 Aliases: 299 Accepted values: Default, Silent, Interactive 300 301 Required: False 302 Position: Named 303 Default value: None 304 Accept pipeline input: True (ByPropertyName) 305 Accept wildcard characters: False 306 ``` 307 308 ### -Moniker 309 310 Specify the moniker of the WinGet package to install. For example, the moniker for the 311 Microsoft.PowerShell package is `pwsh`. 312 313 ```yaml 314 Type: System.String 315 Parameter Sets: FoundSet 316 Aliases: 317 318 Required: False 319 Position: Named 320 Default value: None 321 Accept pipeline input: True (ByPropertyName) 322 Accept wildcard characters: False 323 ``` 324 325 ### -Name 326 327 Specify the name of the package to be installed. 328 329 ```yaml 330 Type: System.String 331 Parameter Sets: FoundSet 332 Aliases: 333 334 Required: False 335 Position: Named 336 Default value: None 337 Accept pipeline input: True (ByPropertyName) 338 Accept wildcard characters: False 339 ``` 340 341 ### -Override 342 343 Use this parameter to override the existing arguments passed to the installer. The parameter takes a single string value. To add multiple arguments, include the arguments in the string. The arguments must be provided in the format expected by the installer. If the string contains spaces, it must be enclosed in quotes. This string overrides the arguments specified in the package manifest. 344 345 ```yaml 346 Type: System.String 347 Parameter Sets: (All) 348 Aliases: 349 350 Required: False 351 Position: Named 352 Default value: None 353 Accept pipeline input: True (ByPropertyName) 354 Accept wildcard characters: False 355 ``` 356 357 ### -PSCatalogPackage 358 359 Provide **PSCatalogPackage** object. You can get a **PSCatalogPackage** object by using the 360 `Find-WinGetPackage` command. 361 362 ```yaml 363 Type: Microsoft.WinGet.Client.Engine.PSObjects.PSCatalogPackage 364 Parameter Sets: GivenSet 365 Aliases: InputObject 366 367 Required: False 368 Position: 0 369 Default value: None 370 Accept pipeline input: True (ByPropertyName, ByValue) 371 Accept wildcard characters: False 372 ``` 373 374 ### -Query 375 376 Specify one or more strings to search for. By default, the command searches all configured sources. 377 The command compares the value provided to the following package manifest properties: 378 - `PackageIdentifier` 379 - `PackageName` 380 - `Moniker` 381 - `Tags` 382 383 The command does a case-insensitive substring comparison of these properties. 384 385 ```yaml 386 Type: System.String[] 387 Parameter Sets: FoundSet 388 Aliases: 389 390 Required: False 391 Position: 0 392 Default value: None 393 Accept pipeline input: True (ByPropertyName) 394 Accept wildcard characters: False 395 ``` 396 397 ### -Scope 398 399 Specify WinGet package installer scope. The parameter accepts the following values: 400 401 - `Any` 402 - `User` 403 - `System` 404 - `UserOrUnknown` 405 - `SystemOrUnknown` 406 407 > [!NOTE] 408 > The installer scope must be available in the WinGet package manifest. 409 410 ```yaml 411 Type: Microsoft.WinGet.Client.PSObjects.PSPackageInstallScope 412 Parameter Sets: (All) 413 Aliases: 414 Accepted values: Any, User, System, UserOrUnknown, SystemOrUnknown 415 416 Required: False 417 Position: Named 418 Default value: None 419 Accept pipeline input: True (ByPropertyName) 420 Accept wildcard characters: False 421 ``` 422 423 ### -SkipDependencies 424 425 Specifies that the command shouldn't install the WinGet package dependencies. 426 427 ```yaml 428 Type: System.Management.Automation.SwitchParameter 429 Parameter Sets: (All) 430 Aliases: 431 432 Required: False 433 Position: Named 434 Default value: None 435 Accept pipeline input: True (ByPropertyName) 436 Accept wildcard characters: False 437 ``` 438 439 ### -Source 440 441 Specify the name of the WinGet source from which the package should be installed. 442 443 ```yaml 444 Type: System.String 445 Parameter Sets: FoundSet 446 Aliases: 447 448 Required: False 449 Position: Named 450 Default value: None 451 Accept pipeline input: True (ByPropertyName) 452 Accept wildcard characters: False 453 ``` 454 455 ### -Version 456 457 Specify the version of the package. 458 459 ```yaml 460 Type: System.String 461 Parameter Sets: (All) 462 Aliases: 463 464 Required: False 465 Position: Named 466 Default value: None 467 Accept pipeline input: True (ByPropertyName) 468 Accept wildcard characters: False 469 ``` 470 471 ### -Confirm 472 473 Prompts you for confirmation before running the cmdlet. 474 475 ```yaml 476 Type: System.Management.Automation.SwitchParameter 477 Parameter Sets: (All) 478 Aliases: cf 479 480 Required: False 481 Position: Named 482 Default value: None 483 Accept pipeline input: False 484 Accept wildcard characters: False 485 ``` 486 487 ### -WhatIf 488 489 Shows what would happen if the cmdlet runs. The cmdlet isn't run. 490 491 ```yaml 492 Type: System.Management.Automation.SwitchParameter 493 Parameter Sets: (All) 494 Aliases: wi 495 496 Required: False 497 Position: Named 498 Default value: None 499 Accept pipeline input: False 500 Accept wildcard characters: False 501 ``` 502 503 ### CommonParameters 504 505 This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, 506 -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, 507 -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see 508 [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). 509 510 ## INPUTS 511 512 ### Microsoft.WinGet.Client.PSObjects.PSPackageInstallMode 513 514 ### System.String 515 516 ### System.Management.Automation.SwitchParameter 517 518 ### Microsoft.WinGet.Client.PSObjects.PSProcessorArchitecture 519 520 ### Microsoft.WinGet.Client.PSObjects.PSPackageInstallerType 521 522 ### Microsoft.WinGet.Client.PSObjects.PSPackageInstallScope 523 524 ### Microsoft.WinGet.Client.Engine.PSObjects.PSCatalogPackage 525 526 ### System.String[] 527 528 ### Microsoft.WinGet.Client.PSObjects.PSPackageFieldMatchOption 529 530 ## OUTPUTS 531 532 ### Microsoft.WinGet.Client.Engine.PSObjects.PSInstallResult 533 534 ## NOTES 535 536 ## RELATED LINKS 537 538 [Find-WinGetPackage](Find-WinGetPackage.md) 539 540 [Update-WinGetPackage](Update-WinGetPackage.md) 541 542 [Uninstall-WinGetPackage](Uninstall-WinGetPackage.md)