MODULE REFERENCE / psfdx-packages
psfdx-packages
Package management
Create, version, promote, install and track first- and second-generation packages.
Part of the psfdx package, which installs every module: see the installation and update instructions.
PS> Get-Command -Module psfdx-packagesCommands
Download Markdown · Source history on GitHub
First-generation packages
Convert-SalesforcePackage
Synopsis
Converts a first-generation managed package into a second-generation managed package.
Syntax
Convert-SalesforcePackage [-Package] <String> [[-DefinitionFile] <String>] [[-InstallationKey] <String>] [-InstallationKeyBypass] [-CodeCoverage] [[-PatchVersion] <String>] [[-SeedMetadata] <String>] [-ExtendedDetails] [[-WaitMinutes] <Int32>] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package convert. The first-generation package must be managed and released (it has a released version). The conversion creates a second-generation package and a first package version in the Dev Hub; it can take a long time, so give -WaitMinutes or follow up with Get-SalesforcePackageVersionCreateStatus. Supports -WhatIf and -Confirm; it does not prompt by default.
Parameters
-PackageString, required- ID of the first-generation managed package to convert (starts with 033). Passed to sf as --package. Required.
-DefinitionFileString- Path to a scratch org definition file used to validate the converted package version. The file must exist. Passed to sf as --definition-file.
-InstallationKeyString- Installation key for the converted package version, a password that subscribers give when they install it. Give -InstallationKey or -InstallationKeyBypass, not both. Passed to sf as --installation-key.
-InstallationKeyBypassswitch- Do not protect the converted package version with an installation key. Adds --installation-key-bypass.
-CodeCoverageswitch- Calculate and store the code coverage of the converted package version. Adds --code-coverage.
-PatchVersionString- Patch version number to give the converted package version. Passed to sf as --patch-version.
-SeedMetadataString- Folder of metadata to include in the converted package version, which is not part of the first-generation package. The folder must exist. Passed to sf as --seed-metadata.
-ExtendedDetailsswitch- Show extended details of the conversion. Adds --verbose.
-WaitMinutesInt32- Number of minutes to wait for the conversion to finish. Passed to sf as --wait.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package convert
Examples
PS> Convert-SalesforcePackage -Package 033xx0000000001AAA -InstallationKeyBypass -WaitMinutes 30 -TargetDevHub devhubConvert the package and wait up to 30 minutes.
Remarks
- To see the examples, type: "Get-Help Convert-SalesforcePackage -Examples"
- For more information, type: "Get-Help Convert-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Convert-SalesforcePackage -Full"
- For online help, type: "Get-Help Convert-SalesforcePackage -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceFirstGenPackageVersion
Synopsis
Shows the details of a first-generation package version.
Syntax
Get-SalesforceFirstGenPackageVersion [-PackageVersionId] <String> [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf package1 version display. It only reads.
Parameters
-PackageVersionIdString, required- ID of the package version (starts with 04t). Passed to sf as --package-version-id. Required.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf package1 version display
Examples
PS> Get-SalesforceFirstGenPackageVersion -PackageVersionId 04txx0000000001AAA -TargetOrg packagingThe details of one version.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceFirstGenPackageVersion -Examples"
- For more information, type: "Get-Help Get-SalesforceFirstGenPackageVersion -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFirstGenPackageVersion -Full"
- For online help, type: "Get-Help Get-SalesforceFirstGenPackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceFirstGenPackageVersionCreateStatus
Synopsis
Shows the status of a first-generation package version upload.
Syntax
Get-SalesforceFirstGenPackageVersionCreateStatus [-RequestId] <String> [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf package1 version create get for the request ID from New-SalesforceFirstGenPackageVersion. It only reads.
Parameters
-RequestIdString, required- ID of the upload request. Passed to sf as --request-id. Required.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf package1 version create get
Examples
PS> Get-SalesforceFirstGenPackageVersionCreateStatus -RequestId 0HD000000000001 -TargetOrg packagingThe state of the upload.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceFirstGenPackageVersionCreateStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceFirstGenPackageVersionCreateStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFirstGenPackageVersionCreateStatus -Full"
- For online help, type: "Get-Help Get-SalesforceFirstGenPackageVersionCreateStatus -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforceFirstGenPackageVersions
Synopsis
Lists first-generation package versions.
Syntax
Get-SalesforceFirstGenPackageVersions [[-PackageId] <String>] [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf package1 version list and returns one object per version. Without -PackageId it lists the versions of every package in the org. It only reads.
Parameters
-PackageIdString- ID of the first-generation package (starts with 033). By default all packages of the org. Passed to sf as --package-id.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf package1 version list
Examples
PS> Get-SalesforceFirstGenPackageVersions -TargetOrg packaging | Format-TableEvery first-generation version in the org.
Remarks
- To see the examples, type: "Get-Help Get-SalesforceFirstGenPackageVersions -Examples"
- For more information, type: "Get-Help Get-SalesforceFirstGenPackageVersions -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFirstGenPackageVersions -Full"
- For online help, type: "Get-Help Get-SalesforceFirstGenPackageVersions -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
New-SalesforceFirstGenPackageVersion
Synopsis
Uploads a new version of a first-generation package.
Syntax
New-SalesforceFirstGenPackageVersion [-PackageId] <String> [-Name] <String> [[-Description] <String>] [[-Version] <String>] [[-InstallationKey] <String>] [-ManagedReleased] [[-PostInstallUrl] <String>] [[-ReleaseNotesUrl] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package1 version create in the packaging org that owns the first-generation package. The upload can take a while: give -WaitMinutes, or follow up with Get-SalesforceFirstGenPackageVersionCreateStatus. For second-generation packages use New-SalesforcePackageVersion. Supports -WhatIf and -Confirm; it does not prompt by default.
Parameters
-PackageIdString, required- ID of the first-generation package (starts with 033). Passed to sf as --package-id. Required.
-NameString, required- Name of the package version. Passed to sf as --name. Required.
-DescriptionString- Description of the package version. Passed to sf as --description.
-VersionString- Version number of the package version, for example 1.2. Passed to sf as --version.
-InstallationKeyString- Installation key that subscribers give when they install the version. Passed to sf as --installation-key.
-ManagedReleasedswitch- Upload the version as managed-released, which cannot be deleted or changed. Without it the version is a beta. Adds --managed-released.
-PostInstallUrlString- URL of the post-install instructions. Passed to sf as --post-install-url.
-ReleaseNotesUrlString- URL of the release notes. Passed to sf as --release-notes-url.
-WaitMinutesInt32- Number of minutes to wait for the upload to finish. Passed to sf as --wait.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package1 version create
Examples
PS> New-SalesforceFirstGenPackageVersion -PackageId 033xx0000000001AAA -Name 'Spring release' -Version 2.1 -WaitMinutes 20 -TargetOrg packagingUpload a beta version and wait.
Remarks
- To see the examples, type: "Get-Help New-SalesforceFirstGenPackageVersion -Examples"
- For more information, type: "Get-Help New-SalesforceFirstGenPackageVersion -Detailed"
- For technical information, type: "Get-Help New-SalesforceFirstGenPackageVersion -Full"
- For online help, type: "Get-Help New-SalesforceFirstGenPackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Package management
Get-SalesforcePackage
Synopsis
Finds one package by name.
Syntax
Get-SalesforcePackage [-Name] <String> [[-TargetDevHub] <String>] [-ExtendedPackageDetails] [<CommonParameters>]Description
Lists the packages with Get-SalesforcePackages and returns the one whose name matches exactly, or nothing.
Parameters
-NameString, required- Exact name of the package. Required.
-TargetDevHubString- Username or alias of the Dev Hub org that owns the package. Passed to Get-SalesforcePackages, which passes it to sf as --target-dev-hub.
-ExtendedPackageDetailsswitch- Include extended package details. Passed to Get-SalesforcePackages, which passes it to sf as --verbose.
Salesforce CLI
No direct Salesforce CLI command.
Examples
PS> Get-SalesforcePackage -Name MyPackage -TargetDevHub devhubThe package record.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackage -Examples"
- For more information, type: "Get-Help Get-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackage -Full"
- For online help, type: "Get-Help Get-SalesforcePackage -Online"
Related Links
Get-SalesforcePackages
Synopsis
Lists the packages in a Dev Hub.
Syntax
Get-SalesforcePackages [[-TargetDevHub] <String>] [-ExtendedPackageDetails] [<CommonParameters>]Description
Runs sf package list and returns one object per package.
Parameters
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-ExtendedPackageDetailsswitch- Display extended package detail. Adds --verbose.
Salesforce CLI
sf package list
Examples
PS> Get-SalesforcePackages -TargetDevHub devhubEvery package in the Dev Hub.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackages -Examples"
- For more information, type: "Get-Help Get-SalesforcePackages -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackages -Full"
- For online help, type: "Get-Help Get-SalesforcePackages -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
New-SalesforcePackage
Synopsis
Creates a package in a Dev Hub.
Syntax
New-SalesforcePackage [-Name] <String> [[-PackageType] <String>] [-IsOrgDependent] [[-Path] <String>] [[-Description] <String>] [[-ErrorNotificationUsername] <String>] [-NoNamespace] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package create. The package type is unlocked or managed.
Parameters
-NameString, required- Name of the package to create. Passed to sf as --name. Required.
-PackageTypeString- Type of package. Passed to sf as --package-type. Default: "Unlocked". Valid values: Managed, Unlocked.
-IsOrgDependentswitch- Depends on unpackaged metadata in the installation org; applies to unlocked packages only. Adds --org-dependent.
-PathString- Path to directory that contains the contents of the package. Passed to sf as --path. Default: "force-app/main/default".
-DescriptionString- Description of the package. Passed to sf as --description.
-ErrorNotificationUsernameString- Active Dev Hub user designated to receive email notifications for package errors. Passed to sf as --error-notification-username.
-NoNamespaceswitch- Create the package with no namespace; available only for unlocked packages. Adds --no-namespace.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package create
Examples
PS> New-SalesforcePackage -Name MyPackage -PackageType Unlocked -Path force-app -TargetDevHub devhubAn unlocked package for the force-app folder.
Remarks
- To see the examples, type: "Get-Help New-SalesforcePackage -Examples"
- For more information, type: "Get-Help New-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help New-SalesforcePackage -Full"
- For online help, type: "Get-Help New-SalesforcePackage -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Remove-SalesforcePackage
Synopsis
Deletes a package.
Syntax
Remove-SalesforcePackage [-Name] <String> [[-TargetDevHub] <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package delete. Asks for confirmation and supports -WhatIf.
Parameters
-NameString, required- ID (starts with 0Ho) or alias of the package to delete. Passed to sf as --package. Required.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-NoPromptswitch- Don't prompt before deleting the package. Adds --no-prompt.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package delete
Examples
PS> Remove-SalesforcePackage -Name MyPackage -TargetDevHub devhub -WhatIfPreview the delete.
Remarks
- To see the examples, type: "Get-Help Remove-SalesforcePackage -Examples"
- For more information, type: "Get-Help Remove-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Remove-SalesforcePackage -Full"
- For online help, type: "Get-Help Remove-SalesforcePackage -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Update-SalesforcePackage
Synopsis
Changes the details of a package in the Dev Hub.
Syntax
Update-SalesforcePackage [-Package] <String> [[-Name] <String>] [[-Description] <String>] [[-ErrorNotificationUsername] <String>] [-EnableAppAnalytics] [[-RecommendedVersionId] <String>] [-SkipAncestorCheck] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package update. Only the properties you give are changed. Supports -WhatIf and -Confirm; it does not prompt by default.
Parameters
-PackageString, required- ID (starts with 0Ho) or alias of the package to update. Passed to sf as --package. Required.
-NameString- New name of the package. Passed to sf as --name.
-DescriptionString- New description of the package. Passed to sf as --description.
-ErrorNotificationUsernameString- User name of the person who gets emails when a package error happens, such as a failed subscriber install. Passed to sf as --error-notification-username.
-EnableAppAnalyticsswitch- Turn on AppExchange App Analytics for the managed package. Adds --enable-app-analytics.
-RecommendedVersionIdString- ID of the package version to recommend to subscribers, starting with 04t. Passed to sf as --recommended-version-id.
-SkipAncestorCheckswitch- Do not check that the recommended version has the right ancestor. Adds --skip-ancestor-check.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package update
Examples
PS> Update-SalesforcePackage -Package MyPkg -Description 'Core features' -TargetDevHub devhub -WhatIfPreview the change without making it.
Remarks
- To see the examples, type: "Get-Help Update-SalesforcePackage -Examples"
- For more information, type: "Get-Help Update-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Update-SalesforcePackage -Full"
- For online help, type: "Get-Help Update-SalesforcePackage -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Installation and removal from orgs
Get-SalesforcePackageInstallStatus
Synopsis
Gets the status of a package install request (sf package install report).
Syntax
Get-SalesforcePackageInstallStatus [-RequestId] <String> [-ThrowOnFailure] [[-TargetOrg] <String>] [<CommonParameters>]Description
Pass the install request ID: the Id (0Hf...) of the object that Install-SalesforcePackageVersion returned when run with -AsObject. The result has Status (IN_PROGRESS, SUCCESS, ERROR or UNKNOWN), Completed, Succeeded, the SubscriberPackageVersionKey (04t) and Errors. A job still running returns Completed = $false. A failed install is returned as a status with its Errors; add -ThrowOnFailure to make it throw PsfdxPackageJobFailed after the object is written. The report is read from the org the package is being installed into (-TargetOrg).
Parameters
-RequestIdString, required- ID of the package install request you want to check; starts with 0Hf. Passed to sf as --request-id. Required.
-ThrowOnFailureswitch- Throw an error (id PsfdxPackageJobFailed) when the installation failed, instead of returning it with Status ERROR. Meant for CI.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf package install report
Examples
PS> $install = Install-SalesforcePackageVersion -PackageVersionId 04t000000000001 -WaitMinutes 0 -NoPrompt -AsObject -TargetOrg myorg; Get-SalesforcePackageInstallStatus -RequestId $install.Id -TargetOrg myorgRemarks
- To see the examples, type: "Get-Help Get-SalesforcePackageInstallStatus -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageInstallStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageInstallStatus -Full"
- For online help, type: "Get-Help Get-SalesforcePackageInstallStatus -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackagesInstalled
Synopsis
Lists the packages installed in an org.
Syntax
Get-SalesforcePackagesInstalled [[-TargetOrg] <String>] [[-ApiVersion] <String>] [<CommonParameters>]Description
Runs sf package installed list and returns one object per installed package version.
Parameters
-TargetOrgString- Username or alias of the org. If omitted, the Salesforce CLI uses the default target org. Passed to sf as --target-org.
-ApiVersionString- REST API version to use for the request, for example 62.0. Passed as --api-version; this is the one cmdlet that exposes it.
Salesforce CLI
sf package installed list
Examples
PS> Get-SalesforcePackagesInstalled -TargetOrg dev1What is installed.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackagesInstalled -Examples"
- For more information, type: "Get-Help Get-SalesforcePackagesInstalled -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackagesInstalled -Full"
- For online help, type: "Get-Help Get-SalesforcePackagesInstalled -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageUninstallStatus
Synopsis
Shows the status of a package uninstall request.
Syntax
Get-SalesforcePackageUninstallStatus [-RequestId] <String> [[-TargetOrg] <String>] [<CommonParameters>]Description
Runs sf package uninstall report. The request ID comes from Uninstall-SalesforcePackage when it returned without waiting. It only reads.
Parameters
-RequestIdString, required- ID of the uninstall request, from Uninstall-SalesforcePackage. Passed to sf as --request-id. Required.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
Salesforce CLI
sf package uninstall report
Examples
PS> Get-SalesforcePackageUninstallStatus -RequestId 06yxx0000000001AAA -TargetOrg dev1The state of the uninstall.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageUninstallStatus -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageUninstallStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageUninstallStatus -Full"
- For online help, type: "Get-Help Get-SalesforcePackageUninstallStatus -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Install-SalesforcePackageVersion
Synopsis
Installs a package version in an org.
Syntax
Install-SalesforcePackageVersion [-PackageVersionId] <String> [[-TargetOrg] <String>] [-NoPrompt] [[-WaitMinutes] <Int32>] [[-SecurityType] <String>] [-AsObject] [[-ApexCompile] <String>] [[-InstallationKey] <String>] [[-UpgradeType] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package install for a version ID (04t...). With -AsObject the result comes back as an object whose Id is the install request ID for Get-SalesforcePackageInstallStatus; without it the CLI's text is returned. Supports -WhatIf and -Confirm (no prompt by default).
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version to install. Passed to sf as --package. Required.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
-NoPromptswitch- Don't prompt for confirmation. Adds --no-prompt.
-WaitMinutesInt32- Maximum number of minutes to wait for the installation to finish, and for the Subscriber Package Version ID to become available in the target org before canceling the install request. Passed to sf as both --wait and --publish-wait. Default: 10.
-SecurityTypeString- Security access type for the installed package. Available options are AdminsOnly and AllUsers. Passed to sf as --security-type. Default: AdminsOnly. Valid values: AllUsers, AdminsOnly.
-AsObjectswitch- Return the install request as an object (adds --json) instead of the CLI's text. Its Id, which starts with 0Hf, is the request ID for Get-SalesforcePackageInstallStatus.
-ApexCompileString- Compile all the Apex in the org and the package, or only the Apex in the package, after the install. Passed to sf as --apex-compile. Valid values: all, package. The CLI default is all.
-InstallationKeyString- Installation key of the package version, for a version that is protected by one. Passed to sf as --installation-key.
-UpgradeTypeString- What happens to the components that an upgrade removes. Passed to sf as --upgrade-type. Valid values: DeprecateOnly, Mixed, Delete. The CLI default is Mixed. Only used for an upgrade of an unlocked package.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package install
Examples
PS> Install-SalesforcePackageVersion -PackageVersionId 04t000000000001AAA -TargetOrg dev1 -WhatIfPreview the install.
Remarks
- To see the examples, type: "Get-Help Install-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Install-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Install-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Install-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Uninstall-SalesforcePackage
Synopsis
Uninstalls a second-generation package from an org.
Syntax
Uninstall-SalesforcePackage [-Package] <String> [[-WaitMinutes] <Int32>] [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package uninstall. The package version and its components are removed from the org, which can delete data stored in the package's custom objects. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. Without -WaitMinutes the request is made and returned; follow it with Get-SalesforcePackageUninstallStatus.
Parameters
-PackageString, required- ID (starts with 04t) or alias of the package version to uninstall. Passed to sf as --package. Required.
-WaitMinutesInt32- Number of minutes to wait for the uninstall to finish. Passed to sf as --wait.
-NoPromptswitch- Do not ask for confirmation. The CLI command has no prompt flag, so this only skips the PowerShell confirmation; it does not turn off -WhatIf.
-TargetOrgString- Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package uninstall
Examples
PS> Uninstall-SalesforcePackage -Package 04txx0000000001AAA -WaitMinutes 10 -TargetOrg dev1 -WhatIfPreview the uninstall without starting it.
Remarks
- To see the examples, type: "Get-Help Uninstall-SalesforcePackage -Examples"
- For more information, type: "Get-Help Uninstall-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Uninstall-SalesforcePackage -Full"
- For online help, type: "Get-Help Uninstall-SalesforcePackage -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Package versions
Get-SalesforcePackageVersion
Synopsis
Shows the details of one package version.
Syntax
Get-SalesforcePackageVersion [-PackageVersionId] <String> [-ExtendedDetails] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version report and returns the version's details (version number, branch, tag, code coverage, validation state, ancestor and more). It only reads. Use Get-SalesforcePackageVersions to list versions.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version. Passed to sf as --package. Required.
-ExtendedDetailsswitch- Show extended details, such as the package version's ancestry. Adds --verbose.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version report
Examples
PS> Get-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -TargetDevHub devhubThe details of one version.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageVersionAncestry
Synopsis
Shows the ancestry tree of a second-generation managed package.
Syntax
Get-SalesforcePackageVersionAncestry [-Package] <String> [-DotCode] [-ExtendedDetails] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version displayancestry. The ancestry shows which version each version builds on. It works for second-generation managed packages. With -DotCode the result is DOT graph code that you can draw with Graphviz.
Parameters
-PackageString, required- ID (starts with 0Ho) or alias of the package, or ID (starts with 04t) or alias of a package version. Passed to sf as --package. Required.
-DotCodeswitch- Return the ancestry as DOT code for Graphviz. Adds --dot-code.
-ExtendedDetailsswitch- Show extended details of each version, such as its ID. Adds --verbose.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version displayancestry
Examples
PS> Get-SalesforcePackageVersionAncestry -Package MyManagedPkg -TargetDevHub devhubThe ancestry tree of the package.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersionAncestry -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersionAncestry -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersionAncestry -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersionAncestry -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageVersionCreateRequests
Synopsis
Lists the package version creation requests of a Dev Hub.
Syntax
Get-SalesforcePackageVersionCreateRequests [[-CreatedLastDays] <Int32>] [-ConversionsOnly] [[-Status] <String>] [-ExtendedDetails] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version create list and returns one object per request (ID, status, package, version, branch, created date). Use Get-SalesforcePackageVersionCreateStatus for one request.
Parameters
-CreatedLastDaysInt32- Only requests created in the last this many days. 0 means today. Passed to sf as --created-last-days.
-ConversionsOnlyswitch- Only requests that convert a first-generation package. Adds --show-conversions-only.
-StatusString- Only requests with this status. Valid values: Queued, InProgress, Success, Error. Passed to sf as --status.
-ExtendedDetailsswitch- Show extended details of each request. Adds --verbose.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version create list
Examples
PS> Get-SalesforcePackageVersionCreateRequests -Status Error -CreatedLastDays 7 -TargetDevHub devhubVersion creations that failed this week.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersionCreateRequests -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersionCreateRequests -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersionCreateRequests -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersionCreateRequests -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageVersionCreateStatus
Synopsis
Gets the status of a package version create request (sf package version create report).
Syntax
Get-SalesforcePackageVersionCreateStatus [-RequestId] <String> [-ThrowOnFailure] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Pass the create request ID: the Id (08c...) of the object that New-SalesforcePackageVersion returned. It is asked of the Dev Hub that owns the package (-TargetDevHub). The result has Status, Completed and Succeeded, the IDs (RequestId, PackageId, PackageVersionId, SubscriberPackageVersionId, the 04t ID to install) and Errors, a list of messages when the job failed. A job still queued or running returns Completed = $false. A failed job is returned as a status (Status = Error) rather than thrown, so a script can read its Errors; add -ThrowOnFailure to make a failed job throw PsfdxPackageJobFailed after the object is written, for CI.
Parameters
-RequestIdString, required- ID (starts with 08c) of the package version creation request you want to display. Passed to sf as --package-create-request-id. Required.
-ThrowOnFailureswitch- Throw an error (id PsfdxPackageJobFailed) when the version creation failed, instead of returning it with its status. Meant for CI.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version create report
Examples
PS> $create = New-SalesforcePackageVersion -PackageName MyPkg -TargetDevHub devhub; Get-SalesforcePackageVersionCreateStatus -RequestId $create.Id -TargetDevHub devhubRemarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersionCreateStatus -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersionCreateStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersionCreateStatus -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersionCreateStatus -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageVersionDependencies
Synopsis
Shows the dependency graph of an unlocked or second-generation managed package version.
Syntax
Get-SalesforcePackageVersionDependencies [-PackageVersionId] <String> [[-EdgeDirection] <String>] [[-InstallationKey] <String>] [-ExtendedDetails] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version displaydependencies. It lists the package versions that the version depends on. The package must have the dependencies set in its project file.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version. Passed to sf as --package. Required.
-EdgeDirectionString- Direction of the graph edges. Valid values: root-first, root-last. The CLI default is root-first. Passed to sf as --edge-direction.
-InstallationKeyString- Installation key of the package version, if it has one. Passed to sf as --installation-key.
-ExtendedDetailsswitch- Show extended details of each dependency. Adds --verbose.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version displaydependencies
Examples
PS> Get-SalesforcePackageVersionDependencies -PackageVersionId 04txx0000000001AAA -TargetDevHub devhubWhat the version depends on.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersionDependencies -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersionDependencies -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersionDependencies -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersionDependencies -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePackageVersions
Synopsis
Lists package versions in a Dev Hub.
Syntax
Get-SalesforcePackageVersions [[-PackageId] <String>] [[-PackageName] <String>] [-Released] [-Concise] [-ExtendedDetails] [-ConversionsOnly] [[-Branch] <String>] [[-CreatedLastDays] <Int32>] [[-ModifiedLastDays] <Int32>] [[-OrderBy] <String>] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version list, for one package (by -PackageId or -PackageName) or for all. Pipe the result to Remove-SalesforcePackageVersion or Promote-SalesforcePackageVersion.
Parameters
-PackageIdString- Comma-delimited list of packages (aliases or 0Ho IDs) to list. Passed to sf as --packages.
-PackageNameString- Name of the package. psfdx finds its ID with Get-SalesforcePackage and passes it as --packages. Use instead of -PackageId.
-Releasedswitch- Display released versions only (IsReleased=true). Adds --released.
-Conciseswitch- Display limited package version details. Adds --concise.
-ExtendedDetailsswitch- Display extended package version details. Adds --verbose.
-ConversionsOnlyswitch- Filter the list output to display only converted package version. Adds --show-conversions-only.
-BranchString- Branch in your source control system used to filter the results; only package versions based on the specified branch are listed. Passed to sf as --branch.
-CreatedLastDaysInt32- Only versions created in the last this many days. 0 means today. Passed to sf as --created-last-days.
-ModifiedLastDaysInt32- Only versions modified in the last this many days. 0 means today. Passed to sf as --modified-last-days.
-OrderByString- Package version fields to order the list by, separated by commas, for example PatchVersion,MajorVersion. Passed to sf as --order-by.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version list
Examples
PS> Get-SalesforcePackageVersions -PackageName MyPackage -Released -TargetDevHub devhubReleased versions of one package.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePackageVersions -Examples"
- For more information, type: "Get-Help Get-SalesforcePackageVersions -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePackageVersions -Full"
- For online help, type: "Get-Help Get-SalesforcePackageVersions -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
New-SalesforcePackageVersion
Synopsis
Creates a package version.
Syntax
New-SalesforcePackageVersion [[-PackageId] <String>] [[-PackageName] <String>] [[-Name] <String>] [[-Description] <String>] [[-Tag] <String>] [[-InstallationKey] <String>] [-InstallationKeyBypass] [-CodeCoverage] [-SkipValidation] [[-WaitMinutes] <Int32>] [[-ScratchOrgDefinitionFile] <String>] [[-Path] <String>] [[-Branch] <String>] [[-VersionNumber] <String>] [[-Language] <String>] [[-PostInstallScript] <String>] [[-UninstallScript] <String>] [[-PostInstallUrl] <String>] [[-ReleaseNotesUrl] <String>] [-SkipAncestorCheck] [-AsyncValidation] [-GeneratePackageZip] [-ExtendedDetails] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version create. Without -WaitMinutes the request is queued and its ID (starts with 08c) is returned for Get-SalesforcePackageVersionCreateStatus.
Parameters
-PackageIdString- ID (starts with 0Ho) or alias of the package to create a version of. Passed to sf as --package.
-PackageNameString- Name of the package. psfdx finds its ID with Get-SalesforcePackage and passes it as --package. Use instead of -PackageId.
-NameString- Name of the package version to be created; overrides the sfdx-project.json value. Passed to sf as --version-name.
-DescriptionString- Description of the package version to be created; overrides the sfdx-project.json value. Passed to sf as --version-description.
-TagString- Package version's tag. Passed to sf as --tag.
-InstallationKeyString- Installation key for key-protected package. (either --installation-key or --installation-key-bypass is required).
-InstallationKeyBypassswitch- Bypass the installation key requirement. (either --installation-key or --installation-key-bypass is required).
-CodeCoverageswitch- Calculate and store the code coverage percentage by running the packaged Apex tests included in this package version. Adds --code-coverage.
-SkipValidationswitch- Skip validation during package version creation; you can't promote unvalidated package versions. Adds --skip-validation.
-WaitMinutesInt32- Number of minutes to wait for the package version to be created. Passed to sf as --wait.
-ScratchOrgDefinitionFileString- Path to a definition file similar to scratch org definition file that contains the list of features and org preferences that the metadata of the package version depends on. Passed to sf as --definition-file. Default: "config/project-scratch-def.json".
-PathString- Path to the directory that contains the contents of the package version, as an alternative to -PackageId or -PackageName. Passed to sf as --path. The directory must exist.
-BranchString- Name of the branch in your source control system that the package version is created from. Passed to sf as --branch.
-VersionNumberString- Version number of the package version, for example 1.2.0.NEXT. Overrides the sfdx-project.json value. Passed to sf as --version-number.
-LanguageString- Language of the package version's metadata, as a language code such as en_US. Passed to sf as --language.
-PostInstallScriptString- Name of the Apex class that runs after the package is installed (managed packages only). Passed to sf as --post-install-script.
-UninstallScriptString- Name of the Apex class that runs when the package is uninstalled (managed packages only). Passed to sf as --uninstall-script.
-PostInstallUrlString- URL of the post-install instructions. Passed to sf as --post-install-url.
-ReleaseNotesUrlString- URL of the release notes. Passed to sf as --releasenotes-url.
-SkipAncestorCheckswitch- Do not check that the new version has the right ancestor. Adds --skip-ancestor-check.
-AsyncValidationswitch- Return the version as soon as it is created and run the validation, including the Apex tests, in the background. Adds --async-validation.
-GeneratePackageZipswitch- Also create a zip file of the package contents and keep it, for managed package versions. Adds --generate-pkg-zip.
-ExtendedDetailsswitch- Show extended details of the version creation. Adds --verbose.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version create
Examples
PS> New-SalesforcePackageVersion -PackageName MyPackage -InstallationKeyBypass -WaitMinutes 30 -TargetDevHub devhubCreate a version and wait.
Remarks
- To see the examples, type: "Get-Help New-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help New-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help New-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help New-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Promote-SalesforcePackageVersion
Synopsis
Promotes a package version to released (sf package version promote).
Syntax
Promote-SalesforcePackageVersion [-PackageVersionId] <String> [[-TargetDevHub] <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Promotion cannot be undone: a released version can no longer be deleted. The cmdlet asks for confirmation and supports -WhatIf. -NoPrompt means you have already decided (as it does for the CLI), so it skips the confirmation and keeps existing unattended scripts working; -WhatIf still makes no call. -PackageVersionId can come from the pipeline, through the SubscriberPackageVersionId (04t) of a version from Get-SalesforcePackageVersions.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version to promote. Passed to sf as --package. Required. Alias: SubscriberPackageVersionId. Accepts input from the pipeline by property name.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-NoPromptswitch- Don't prompt to confirm setting the package version as released. Adds --no-prompt.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package version promote
Examples
PS> Get-SalesforcePackageVersions -PackageName MyPkg | Select-Object -First 1 | Promote-SalesforcePackageVersion -WhatIfRemarks
- To see the examples, type: "Get-Help Promote-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Promote-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Promote-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Promote-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Remove-SalesforcePackageVersion
Synopsis
Deletes a package version (sf package version delete).
Syntax
Remove-SalesforcePackageVersion [-PackageVersionId] <String> [[-TargetDevHub] <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]Description
-PackageVersionId can come from the pipeline: a version from Get-SalesforcePackageVersions is used through its SubscriberPackageVersionId (04t). Each version is confirmed on its own, so -WhatIf previews every delete.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version to delete. Passed to sf as --package. Required. Alias: SubscriberPackageVersionId. Accepts input from the pipeline by property name.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-NoPromptswitch- Don't prompt before deleting the package version. Adds --no-prompt.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package version delete
Examples
PS> Get-SalesforcePackageVersions -PackageName MyPkg | Where-Object { -not $_.IsReleased } | Remove-SalesforcePackageVersion -WhatIfRemarks
- To see the examples, type: "Get-Help Remove-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Remove-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Remove-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Remove-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Retrieve-SalesforcePackageVersion
Synopsis
Downloads the metadata of a package version into a folder.
Syntax
Retrieve-SalesforcePackageVersion [-PackageVersionId] <String> [[-OutputDirectory] <String>] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package version retrieve. It works only for second-generation managed package versions and unlocked package versions. The metadata is written under -OutputDirectory.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version to retrieve. Passed to sf as --package. Required.
-OutputDirectoryString- Folder to write the metadata to. By default the CLI uses a temporary folder and reports it. Passed to sf as --output-dir.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package version retrieve
Examples
PS> Retrieve-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -OutputDirectory .\pkg-source -TargetDevHub devhubDownload the version's metadata.
Remarks
- To see the examples, type: "Get-Help Retrieve-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Retrieve-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Retrieve-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Update-SalesforcePackageVersion
Synopsis
Changes the details of a package version.
Syntax
Update-SalesforcePackageVersion [-PackageVersionId] <String> [[-Branch] <String>] [[-InstallationKey] <String>] [[-Tag] <String>] [[-Description] <String>] [[-Name] <String>] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package version update. Only the properties you give are changed. A released version can change only some of them. Supports -WhatIf and -Confirm; it does not prompt by default.
Parameters
-PackageVersionIdString, required- ID (starts with 04t) or alias of the package version to update. Passed to sf as --package. Required.
-BranchString- New branch of the package version. Passed to sf as --branch.
-InstallationKeyString- New installation key, a password that subscribers give when they install the version. Passed to sf as --installation-key.
-TagString- New tag of the package version. Passed to sf as --tag.
-DescriptionString- New description of the package version. Passed to sf as --version-description.
-NameString- New name of the package version. Passed to sf as --version-name.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package version update
Examples
PS> Update-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -Tag release-1 -TargetDevHub devhubTag a version.
Remarks
- To see the examples, type: "Get-Help Update-SalesforcePackageVersion -Examples"
- For more information, type: "Get-Help Update-SalesforcePackageVersion -Detailed"
- For technical information, type: "Get-Help Update-SalesforcePackageVersion -Full"
- For online help, type: "Get-Help Update-SalesforcePackageVersion -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Push upgrades
Get-SalesforcePushUpgrade
Synopsis
Shows the status of one push upgrade request.
Syntax
Get-SalesforcePushUpgrade [-PushRequestId] <String> [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package push-upgrade report for the request ID that New-SalesforcePushUpgrade returned. It only reads.
Parameters
-PushRequestIdString, required- ID of the push upgrade request (starts with 0DV). Passed to sf as --push-request-id. Required.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package push-upgrade report
Examples
PS> Get-SalesforcePushUpgrade -PushRequestId 0DVxx0000000001AAA -TargetDevHub devhubThe state of one push upgrade.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePushUpgrade -Examples"
- For more information, type: "Get-Help Get-SalesforcePushUpgrade -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePushUpgrade -Full"
- For online help, type: "Get-Help Get-SalesforcePushUpgrade -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Get-SalesforcePushUpgrades
Synopsis
Lists the push upgrade requests of a package.
Syntax
Get-SalesforcePushUpgrades [-Package] <String> [[-ScheduledLastDays] <Int32>] [-ShowMigrationsOnly] [[-Status] <String>] [[-TargetDevHub] <String>] [<CommonParameters>]Description
Runs sf package push-upgrade list and returns one object per request (ID, status, package version, scheduled start and end). It only reads.
Parameters
-PackageString, required- ID (starts with 0Ho) or alias of the package. Passed to sf as --package. Required.
-ScheduledLastDaysInt32- Only requests scheduled in the last this many days. Passed to sf as --scheduled-last-days.
-ShowMigrationsOnlyswitch- Only requests that migrate subscribers to a second-generation package. Adds --show-push-migrations-only.
-StatusString- Only requests with this status. Valid values: Created, Cancelled, Pending, In Progress, Failed, Succeeded. Passed to sf as --status.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
Salesforce CLI
sf package push-upgrade list
Examples
PS> Get-SalesforcePushUpgrades -Package MyManagedPkg -Status Pending -TargetDevHub devhubPush upgrades that have not started.
Remarks
- To see the examples, type: "Get-Help Get-SalesforcePushUpgrades -Examples"
- For more information, type: "Get-Help Get-SalesforcePushUpgrades -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePushUpgrades -Full"
- For online help, type: "Get-Help Get-SalesforcePushUpgrades -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
New-SalesforcePushUpgrade
Synopsis
Schedules a push upgrade of a managed package version to subscriber orgs.
Syntax
New-SalesforcePushUpgrade [-Package] <String> [[-OrgList] <String[]>] [[-OrgFile] <String>] [[-StartTime] <DateTime>] [-MigrateTo2gp] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package push-upgrade schedule. A push upgrade installs a package version in subscriber orgs without their admins starting it. It cannot be undone once it starts, though a request that has not started can be stopped with Stop-SalesforcePushUpgrade. Give the subscriber orgs as -OrgList or -OrgFile. Asks for confirmation and supports -WhatIf.
Parameters
-PackageString, required- ID (starts with 04t) or alias of the package version to push. Passed to sf as --package. Required.
-OrgListString[]- IDs of the subscriber orgs to upgrade (start with 00D). Joined with commas. Passed to sf as --org-list.
-OrgFileString- Path of a CSV file that lists the subscriber org IDs, one per line. The file must exist. Passed to sf as --org-file.
-StartTimeDateTime- When to start the push upgrade, as a date and time. It is sent in UTC (a time without a time zone is read as local time). By default the upgrade starts as soon as possible. Passed to sf as --start-time.
-MigrateTo2gpswitch- Migrate the subscriber orgs from a first-generation to a second-generation package. Adds --migrate-to-2gp.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package push-upgrade schedule
Examples
PS> New-SalesforcePushUpgrade -Package 04txx0000000001AAA -OrgList 00Dxx0000000001, 00Dxx0000000002 -StartTime '2026-12-01 02:00' -TargetDevHub devhub -WhatIfPreview a scheduled push upgrade.
Remarks
- To see the examples, type: "Get-Help New-SalesforcePushUpgrade -Examples"
- For more information, type: "Get-Help New-SalesforcePushUpgrade -Detailed"
- For technical information, type: "Get-Help New-SalesforcePushUpgrade -Full"
- For online help, type: "Get-Help New-SalesforcePushUpgrade -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Stop-SalesforcePushUpgrade
Synopsis
Cancels a scheduled push upgrade.
Syntax
Stop-SalesforcePushUpgrade [-PushRequestId] <String> [-NoPrompt] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Runs sf package push-upgrade abort. Only a request with the status Created or Pending can be aborted; one that has started cannot. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question.
Parameters
-PushRequestIdString, required- ID of the push upgrade request to abort (starts with 0DV). Passed to sf as --push-request-id. Required.
-NoPromptswitch- Do not ask for confirmation. The CLI command has no prompt flag, so this only skips the PowerShell confirmation; it does not turn off -WhatIf.
-TargetDevHubString- Username or alias of the Dev Hub org. Not required if the `target-dev-hub` configuration variable is already set. Passed to sf as --target-dev-hub.
-WhatIfswitch-Confirmswitch
Salesforce CLI
sf package push-upgrade abort
Examples
PS> Stop-SalesforcePushUpgrade -PushRequestId 0DVxx0000000001AAA -TargetDevHub devhub -WhatIfPreview the abort.
Remarks
- To see the examples, type: "Get-Help Stop-SalesforcePushUpgrade -Examples"
- For more information, type: "Get-Help Stop-SalesforcePushUpgrade -Detailed"
- For technical information, type: "Get-Help Stop-SalesforcePushUpgrade -Full"
- For online help, type: "Get-Help Stop-SalesforcePushUpgrade -Online"
Related Links
- https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html
- https://github.com/salesforcecli/plugin-packaging
- https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md
- https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters
Further reference: repository command catalogue · Salesforce CLI parity report.
