|
| 1 | +--- |
| 2 | +external help file: AnyPackage.dll-Help.xml |
| 3 | +Module Name: AnyPackage |
| 4 | +online version: https://go.anypackage.dev/Optimize-Package |
| 5 | +parent: AnyPackage |
| 6 | +schema: 2.0.0 |
| 7 | +--- |
| 8 | + |
| 9 | +# Optimize-Package |
| 10 | + |
| 11 | +## SYNOPSIS |
| 12 | + |
| 13 | +Removes outdated packages. |
| 14 | + |
| 15 | +## SYNTAX |
| 16 | + |
| 17 | +```text |
| 18 | +Optimize-Package [[-Name] <string[]>] [-Provider <string>] [-PassThru] |
| 19 | + [-WhatIf] [-Confirm] [<CommonParameters>] |
| 20 | +``` |
| 21 | + |
| 22 | +## DESCRIPTION |
| 23 | + |
| 24 | +Removes outdated packages. |
| 25 | + |
| 26 | +## EXAMPLES |
| 27 | + |
| 28 | +### Example 1: Optimize all packages |
| 29 | + |
| 30 | +```powershell |
| 31 | +Optimize-Package |
| 32 | +
|
| 33 | +Name Version Source Provider |
| 34 | +---- ------- ---------- -------- |
| 35 | +Microsoft.PowerShell.Archive 1.2.5.0 PSGallery PowerShellGet |
| 36 | +Microsoft.PowerShell.ConsoleGuiTools 0.7.2.0 PSGallery PowerShellGet |
| 37 | +``` |
| 38 | + |
| 39 | +The command removes outdated packages from registered package providers. |
| 40 | + |
| 41 | +### Example 2: Optimize all package from a provider |
| 42 | + |
| 43 | +```powershell |
| 44 | +Optimize-Package -Provider PowerShellGet |
| 45 | +
|
| 46 | +Name Version Source Provider |
| 47 | +---- ------- ---------- -------- |
| 48 | +Microsoft.PowerShell.Archive 1.2.5.0 PSGallery PowerShellGet |
| 49 | +Microsoft.PowerShell.ConsoleGuiTools 0.7.2.0 PSGallery PowerShellGet |
| 50 | +``` |
| 51 | + |
| 52 | +The command removes outdated packages from `PowerShellGet` package provider. |
| 53 | + |
| 54 | +## PARAMETERS |
| 55 | + |
| 56 | +### -Name |
| 57 | + |
| 58 | +Specifies the package name. |
| 59 | + |
| 60 | +```yaml |
| 61 | +Type: String[] |
| 62 | +Parameter Sets: (All) |
| 63 | +Aliases: |
| 64 | + |
| 65 | +Required: False |
| 66 | +Position: 0 |
| 67 | +Default value: * |
| 68 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 69 | +Accept wildcard characters: True |
| 70 | +``` |
| 71 | +
|
| 72 | +### -Provider |
| 73 | +
|
| 74 | +Specifies the package provider. |
| 75 | +
|
| 76 | +```yaml |
| 77 | +Type: String |
| 78 | +Parameter Sets: (All) |
| 79 | +Aliases: |
| 80 | + |
| 81 | +Required: False |
| 82 | +Position: Named |
| 83 | +Default value: None |
| 84 | +Accept pipeline input: False |
| 85 | +Accept wildcard characters: False |
| 86 | +``` |
| 87 | +
|
| 88 | +### CommonParameters |
| 89 | +
|
| 90 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, |
| 91 | +-ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, |
| 92 | +-OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. |
| 93 | +For more information, see |
| 94 | +[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 95 | +
|
| 96 | +## INPUTS |
| 97 | +
|
| 98 | +### System.String, AnyPackage.Provider.PackageVersionRange |
| 99 | +
|
| 100 | +You can pipe a package name to this cmdlet. |
| 101 | +
|
| 102 | +## OUTPUTS |
| 103 | +
|
| 104 | +### AnyPackage.Provider.PackageInfo |
| 105 | +
|
| 106 | +This cmdlet returns objects that represent a package. |
| 107 | +
|
| 108 | +## NOTES |
| 109 | +
|
| 110 | +## RELATED LINKS |
| 111 | +
|
| 112 | +[Find-Package](Find-Package.md) |
| 113 | +
|
| 114 | +[Install-Package](Install-Package.md) |
| 115 | +
|
| 116 | +[Publish-Package](Publish-Package.md) |
| 117 | +
|
| 118 | +[Save-Package](Save-Package.md) |
| 119 | +
|
| 120 | +[Update-Package](Update-Package.md) |
| 121 | +
|
| 122 | +[Uninstall-Package](Uninstall-Package.md) |
0 commit comments