| external help file | Microsoft.PowerShell.PSResourceGet.dll-Help.xml |
|---|---|
| Module Name | Microsoft.PowerShell.PSResourceGet |
| ms.custom | 1.2.0-p5 |
| ms.date | 12/10/2025 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.psresourceget/compress-psresource?view=powershellget-3.x&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
Compresses a specified folder containing module or script resources into a .nupkg file.
Compress-PSResource [-Path] <String> [-DestinationPath] <String> [-PassThru]
[-SkipModuleManifestValidate] [-WhatIf] [-Confirm] [<CommonParameters>]
This cmdlet compresses a specified folder containing module or script resources into a .nupkg
file. isolates the pack feature in the Publish-PSResource cmdlet. This allows you to sign the
.nupkg file before publishing it to a repository. You can publish the final .nupkg file using
the NupkgPath parameter of Publish-PSResource.
This command was added in v1.1.0 of Microsoft.PowerShell.PSResourceGet.
This example compresses the module TestModule and saves te nupkg to the DestinationPath.
Compress-PSResource -Path C:\TestModule -DestinationPath C:\NupkgDestinationPath to save the compressed resource.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePass the full path of the nupkg through the pipeline.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePath to the resource to be compressed.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSkips validating the module manifest before creating the .nupkg file.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet isn't run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
By default, this command doesn't write any output to the pipeline. When you use the PassThru
parameter, it returns a FileInfo object for the new .nupkg file.
The module defines cmres as an alias for Compress-PSResource.
This cmdlet allows for publishing nuspec dependencies into ACR.