# psfdx full command reference

---

[Source history](https://github.com/tonygward/psfdx/commits/main/docs/reference)

---

# psfdx command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

39 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Authentication and aliases**: [Add-SalesforceAlias](#add-salesforcealias), [Connect-Salesforce](#connect-salesforce), [Connect-SalesforceAccessToken](#connect-salesforceaccesstoken), [Connect-SalesforceApi](#connect-salesforceapi), [Connect-SalesforceAuthUrl](#connect-salesforceauthurl), [Connect-SalesforceJwt](#connect-salesforcejwt), [Disconnect-Salesforce](#disconnect-salesforce), [Get-SalesforceAlias](#get-salesforcealias), [Get-SalesforceAuthenticatedUser](#get-salesforceauthenticateduser), [Get-SalesforceAuthorizations](#get-salesforceauthorizations), [Get-SalesforceConnections](#get-salesforceconnections), [Open-Salesforce](#open-salesforce), [Remove-SalesforceAlias](#remove-salesforcealias), [Repair-SalesforceConnections](#repair-salesforceconnections)

**SOQL helpers**: [ConvertTo-SalesforceSoqlDateTime](#convertto-salesforcesoqldatetime), [ConvertTo-SalesforceSoqlIdentifier](#convertto-salesforcesoqlidentifier), [ConvertTo-SalesforceSoqlLiteral](#convertto-salesforcesoqlliteral)

**APIs**: [Get-SalesforceApiUsage](#get-salesforceapiusage), [Get-SalesforceApiVersions](#get-salesforceapiversions), [Get-SalesforceLatestApiVersion](#get-salesforcelatestapiversion), [Invoke-SalesforceApi](#invoke-salesforceapi), [Invoke-SalesforceGraphQL](#invoke-salesforcegraphql), [Invoke-SalesforceRestRequest](#invoke-salesforcerestrequest)

**Experience Cloud**: [Get-SalesforceCommunityTemplates](#get-salesforcecommunitytemplates), [New-SalesforceCommunity](#new-salesforcecommunity), [Publish-SalesforceCommunity](#publish-salesforcecommunity)

**Tools and org information**: [Get-SalesforceDataStorage](#get-salesforcedatastorage), [Get-SalesforceDateTime](#get-salesforcedatetime), [Get-SalesforceLimits](#get-salesforcelimits), [Get-SalesforceOrgDetails](#get-salesforceorgdetails), [Install-SalesforceCli](#install-salesforcecli), [Invoke-SalesforceDoctor](#invoke-salesforcedoctor), [Update-SalesforceCli](#update-salesforcecli)

**Users and permissions**: [Get-SalesforceOrgUser](#get-salesforceorguser), [Get-SalesforceUsers](#get-salesforceusers), [Grant-SalesforcePermissionSet](#grant-salesforcepermissionset), [Grant-SalesforcePermissionSetLicense](#grant-salesforcepermissionsetlicense), [New-SalesforceUser](#new-salesforceuser), [New-SalesforceUserPassword](#new-salesforceuserpassword)

## Authentication and aliases

### Add-SalesforceAlias

#### Synopsis

Sets a local alias for an org so you can use a short name instead of its username.

#### Syntax

```powershell
Add-SalesforceAlias [-Alias] <String> [-TargetOrg] <String> [<CommonParameters>]
```

#### Description

Stores the alias in the Salesforce CLI configuration on this computer; nothing changes in the org. Once set, the alias works anywhere a psfdx cmdlet takes -TargetOrg.

#### Parameters

- `-Alias` (String, required): The alias to create, for example prod or dev1. Setting an alias that already exists replaces it. Required.
- `-TargetOrg` (String, required): Username, or an existing alias, that the new alias should point to. Required.

#### Salesforce CLI

- `sf alias set`

#### Examples

```powershell
PS> Add-SalesforceAlias -Alias dev1 -TargetOrg user@example.com.dev1
```

Create the alias dev1 for that username.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceAlias -Examples"
- For more information, type: "Get-Help Add-SalesforceAlias -Detailed"
- For technical information, type: "Get-Help Add-SalesforceAlias -Full"
- For online help, type: "Get-Help Add-SalesforceAlias -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Connect-Salesforce

#### Synopsis

Logs in to an org in a web browser and saves the authorization.

#### Syntax

```powershell
Connect-Salesforce [-Sandbox] [[-CustomUrl] <String>] [[-Alias] <String>] [-SetDefault] [-SetDefaultDevHub] [[-Browser] <String>] [[-OAuthClientId] <String>] [[-ClientApp] <String>] [[-Scopes] <String>] [[-Username] <String>] [<CommonParameters>]
```

#### Description

Opens the login page of Salesforce in your browser. After you sign in, the Salesforce CLI stores the authorization on this computer so other psfdx cmdlets can use the org. Use -Sandbox for a sandbox, or -CustomUrl for a My Domain or other login URL.

#### Parameters

- `-Sandbox` (switch): Log in through the sandbox login host. psfdx passes --instance-url https://test.salesforce.com. Use -CustomUrl instead for a different host.
- `-CustomUrl` (String): URL of the instance that the org lives on. Passed to sf as --instance-url.
- `-Alias` (String): Alias for the org. Passed to sf as --alias.
- `-SetDefault` (switch): Set the authenticated org as the default that all org-related commands run against. Adds --set-default.
- `-SetDefaultDevHub` (switch): Set the authenticated org as the default Dev Hub. Adds --set-default-dev-hub.
- `-Browser` (String): Browser in which to open the org. Passed to sf as --browser. Valid values: chrome, edge, firefox.
- `-OAuthClientId` (String): OAuth client ID (also called consumer key) of your custom connected app. Passed to sf as --client-id.
- `-ClientApp` (String): Name that saves this login as a separate authorization for the same user, so you can log in to one org with more than one connected app. Passed to sf as --client-app. Use the same name with Disconnect-Salesforce -ClientApp to log it out.
- `-Scopes` (String): OAuth scopes to request, separated by spaces, for example "api web refresh_token". Passed to sf as --scopes. Use it with your own connected app (-OAuthClientId).
- `-Username` (String): User name to log in as, which pre-fills the login page. Passed to sf as --username.

#### Salesforce CLI

- `sf org login web`

#### Examples

```powershell
PS> Connect-Salesforce -Alias prod -SetDefault
```

Log in to production, give the org the alias prod and make it the default target org.

#### Remarks

- To see the examples, type: "Get-Help Connect-Salesforce -Examples"
- For more information, type: "Get-Help Connect-Salesforce -Detailed"
- For technical information, type: "Get-Help Connect-Salesforce -Full"
- For online help, type: "Get-Help Connect-Salesforce -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Connect-SalesforceAccessToken

#### Synopsis

Logs in to an org with an access token you already have.

#### Syntax

```powershell
Connect-SalesforceAccessToken [-InstanceUrl] <String> [-AccessToken] <SecureString> [[-Alias] <String>] [-SetDefault] [-SetDefaultDevHub] [-NoPrompt] [<CommonParameters>]
```

#### Description

Runs sf org login access-token. Give the org's instance URL and the access token as a SecureString. The token is handed to the CLI in the SF_ACCESS_TOKEN environment variable of the sf process only, never on the command line, and the variable is put back to its earlier value afterwards. The login is saved on this computer so other psfdx cmdlets can use the org. The authorization cannot be refreshed, so it stops working when the token expires. Because the environment belongs to the whole process, logins started at the same time in one PowerShell process run one after the other. The URL must be an absolute https URL, because the token is sent to it. Tokens and authorization URLs are removed from the result.

#### Parameters

- `-InstanceUrl` (String, required): URL of the org, for example https://mycompany.my.salesforce.com. Must be an absolute https:// URL. Passed to sf as --instance-url. Required.
- `-AccessToken` (SecureString, required): The access token, as a SecureString, for example (Read-Host -AsSecureString). Passed to sf in the SF_ACCESS_TOKEN environment variable. Required.
- `-Alias` (String): Alias for the org. Passed to sf as --alias.
- `-SetDefault` (switch): Set the authenticated org as the default that all org-related commands run against. Adds --set-default.
- `-SetDefaultDevHub` (switch): Set the authenticated org as the default Dev Hub. Adds --set-default-dev-hub.
- `-NoPrompt` (switch): Don't prompt for confirmation, for example before overwriting an existing login. Adds --no-prompt.

#### Salesforce CLI

- `sf org login access-token`

#### Examples

```powershell
PS> Connect-SalesforceAccessToken -InstanceUrl https://mycompany.my.salesforce.com -AccessToken (Read-Host -AsSecureString) -Alias ci -NoPrompt
```

Log in with a token that you type at the prompt.

#### Remarks

- To see the examples, type: "Get-Help Connect-SalesforceAccessToken -Examples"
- For more information, type: "Get-Help Connect-SalesforceAccessToken -Detailed"
- For technical information, type: "Get-Help Connect-SalesforceAccessToken -Full"
- For online help, type: "Get-Help Connect-SalesforceAccessToken -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Connect-SalesforceApi

#### Synopsis

Gets an access token for the Salesforce REST API with the username-password OAuth flow.

#### Syntax

```powershell
Connect-SalesforceApi [-TargetOrg] <String> [-Password] <Object> [-Token] <Object> [-ClientId] <String> [-ClientSecret] <Object> [-Sandbox] [[-CustomUrl] <String>] [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI. It posts the user name, the password plus security token, and the connected app client ID and secret to the org's /services/oauth2/token endpoint with Invoke-RestMethod and returns the response, which holds the access token and instance URL. The request is sent only over https. Pass the password, token and client secret as SecureString: they are converted to text only when the request is built and are never written to the verbose, debug or error output. Plain strings still work but write a warning, because they stay in your session history and memory.

#### Parameters

- `-TargetOrg` (String, required): The Salesforce user name to log in as (sent as the OAuth username). This is not an org alias. Required.
- `-Password` (Object, required): The user's password, as a SecureString (preferred) or a plain string (deprecated, writes a warning). The security token is appended to it. Required.
- `-Token` (Object, required): The user's security token, as a SecureString (preferred) or a plain string (deprecated, writes a warning). Appended to the password. Required.
- `-ClientId` (String, required): Consumer key of the connected app used for the login. Required.
- `-ClientSecret` (Object, required): Consumer secret of the connected app, as a SecureString (preferred) or a plain string (deprecated, writes a warning). Required.
- `-Sandbox` (switch): Use the sandbox login host https://test.salesforce.com instead of https://login.salesforce.com.
- `-CustomUrl` (String): Base URL of the login host to use instead, for example a My Domain. It must be an absolute https:// URL, otherwise the cmdlet stops before sending anything.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Connect-SalesforceApi -TargetOrg user@example.com -Password $pw -Token $tok -ClientId $key -ClientSecret $secret
```

Request an access token from production.

#### Remarks

- To see the examples, type: "Get-Help Connect-SalesforceApi -Examples"
- For more information, type: "Get-Help Connect-SalesforceApi -Detailed"
- For technical information, type: "Get-Help Connect-SalesforceApi -Full"
- For online help, type: "Get-Help Connect-SalesforceApi -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Connect-SalesforceAuthUrl

#### Synopsis

Logs in to an org with a Salesforce DX authorization URL stored in a file.

#### Syntax

```powershell
Connect-SalesforceAuthUrl [-SfdxUrlFile] <String> [[-Alias] <String>] [-SetDefault] [-SetDefaultDevHub] [-IncludeToken] [<CommonParameters>]
```

#### Description

Runs sf org login sfdx-url with the file you give. The result has the access token and auth URL removed unless you pass -IncludeToken. Keep the file safe: anyone who has it can log in as that user.

#### Parameters

- `-SfdxUrlFile` (String, required): Path to a file that contains the Salesforce DX authorization URL. Passed to sf as --sfdx-url-file. Required.
- `-Alias` (String): Alias for the org. Passed to sf as --alias.
- `-SetDefault` (switch): Set the authenticated org as the default that all org-related commands run against. Adds --set-default.
- `-SetDefaultDevHub` (switch): Set the authenticated org as the default Dev Hub. Adds --set-default-dev-hub.
- `-IncludeToken` (switch): Return the CLI result as it is. Current CLI versions do not return tokens or auth URLs for this command, so this may change nothing. Without it psfdx removes accessToken, refreshToken, sfdxAuthUrl, password, clientSecret and privateKey from the result.

#### Salesforce CLI

- `sf org login sfdx-url`

#### Examples

```powershell
PS> Connect-SalesforceAuthUrl -SfdxUrlFile .\auth.txt -Alias ci -SetDefault
```

Log in from the file and make the org the default.

#### Remarks

- To see the examples, type: "Get-Help Connect-SalesforceAuthUrl -Examples"
- For more information, type: "Get-Help Connect-SalesforceAuthUrl -Detailed"
- For technical information, type: "Get-Help Connect-SalesforceAuthUrl -Full"
- For online help, type: "Get-Help Connect-SalesforceAuthUrl -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Connect-SalesforceJwt

#### Synopsis

Logs in to an org without a browser, using a JSON web token and a private key.

#### Syntax

```powershell
Connect-SalesforceJwt [-ConsumerKey] <String> [-TargetOrg] <String> [-JwtKeyfile] <String> [-Sandbox] [[-Alias] <String>] [-SetDefault] [-SetDefaultDevHub] [<CommonParameters>]
```

#### Description

Runs sf org login jwt with the connected app's consumer key, the user name and the private key file. It is meant for CI. The key file must exist; its content is never read or printed by psfdx. The login host is https://login.salesforce.com, or https://test.salesforce.com with -Sandbox.

#### Parameters

- `-ConsumerKey` (String, required): OAuth client ID (also called consumer key) of your custom connected app. Passed to sf as --client-id. Required.
- `-TargetOrg` (String, required): Username of the user logging in. Passed to sf as --username. Required.
- `-JwtKeyfile` (String, required): Path to a file containing the private key. Passed to sf as --jwt-key-file. Required.
- `-Sandbox` (switch): Log in at https://test.salesforce.com. psfdx always passes --instance-url: production by default, the sandbox host with this switch.
- `-Alias` (String): Alias for the org. Passed to sf as --alias.
- `-SetDefault` (switch): Set the authenticated org as the default that all org-related commands run against. Adds --set-default.
- `-SetDefaultDevHub` (switch): Set the authenticated org as the default Dev Hub. Adds --set-default-dev-hub.

#### Salesforce CLI

- `sf org login jwt`

#### Examples

```powershell
PS> Connect-SalesforceJwt -ConsumerKey $key -TargetOrg ci@example.com -JwtKeyfile .\server.key -Alias ci -SetDefault
```

Log in a CI user and make it the default target org.

#### Remarks

- To see the examples, type: "Get-Help Connect-SalesforceJwt -Examples"
- For more information, type: "Get-Help Connect-SalesforceJwt -Detailed"
- For technical information, type: "Get-Help Connect-SalesforceJwt -Full"
- For online help, type: "Get-Help Connect-SalesforceJwt -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Disconnect-Salesforce

#### Synopsis

Logs out of one org, or all orgs, and removes the saved authorization.

#### Syntax

```powershell
Disconnect-Salesforce -TargetOrg <String> [-ClientApp <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
Disconnect-Salesforce -All [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org logout. The authorization is removed from this computer; scratch orgs and sandboxes are not deleted. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-All` (switch, required): Log out of every org this computer is authorized for. Use it instead of -TargetOrg. Required in the All parameter set.
- `-TargetOrg` (String, required): Username or alias of the target org. Passed to sf as --target-org. Required in the TargetOrg parameter set.
- `-ClientApp` (String): Name of the client app login to log out of, the name given to Connect-Salesforce -ClientApp. Passed to sf as --client-app. Use it with -TargetOrg.
- `-NoPrompt` (switch): Don't prompt for confirmation. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org logout`

#### Examples

```powershell
PS> Disconnect-Salesforce -TargetOrg dev1 -WhatIf
```

Show what would happen without logging out.

#### Remarks

- To see the examples, type: "Get-Help Disconnect-Salesforce -Examples"
- For more information, type: "Get-Help Disconnect-Salesforce -Detailed"
- For technical information, type: "Get-Help Disconnect-Salesforce -Full"
- For online help, type: "Get-Help Disconnect-Salesforce -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAlias

#### Synopsis

Lists the org aliases set on this computer.

#### Syntax

```powershell
Get-SalesforceAlias [<CommonParameters>]
```

#### Description

Runs sf alias list and returns the aliases, each with the value it points to. Reads local CLI configuration only; it does not contact an org.

#### Salesforce CLI

- `sf alias list`

#### Examples

```powershell
PS> Get-SalesforceAlias
```

List every alias.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAlias -Examples"
- For more information, type: "Get-Help Get-SalesforceAlias -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAlias -Full"
- For online help, type: "Get-Help Get-SalesforceAlias -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAuthenticatedUser

#### Synopsis

Lists the users of an org that the Salesforce CLI has authorised on this computer (sf org list users).

#### Syntax

```powershell
Get-SalesforceAuthenticatedUser [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Tokens are removed from the result. To search all users in the org, use Get-SalesforceUsers.

#### Parameters

- `-TargetOrg` (String): 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 org list users`

#### Examples

```powershell
PS> Get-SalesforceAuthenticatedUser -TargetOrg myscratch
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAuthenticatedUser -Examples"
- For more information, type: "Get-Help Get-SalesforceAuthenticatedUser -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAuthenticatedUser -Full"
- For online help, type: "Get-Help Get-SalesforceAuthenticatedUser -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAuthorizations

#### Synopsis

Lists every authorization the Salesforce CLI has saved on this computer.

#### Syntax

```powershell
Get-SalesforceAuthorizations [<CommonParameters>]
```

#### Description

Runs sf org list auth and returns one object per saved authorization (user name, org ID, instance URL, aliases, how it was authorized and whether it has expired). Unlike Get-SalesforceConnections it does not contact the orgs, so it is quick and works offline. Tokens and authorization URLs are removed from the result.

#### Salesforce CLI

- `sf org list auth`

#### Examples

```powershell
PS> Get-SalesforceAuthorizations | Format-Table username, aliases, instanceUrl
PS> A quick overview of the saved logins.
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAuthorizations -Examples"
- For more information, type: "Get-Help Get-SalesforceAuthorizations -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAuthorizations -Full"
- For online help, type: "Get-Help Get-SalesforceAuthorizations -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-auth>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceConnections

#### Synopsis

Lists the orgs this computer is logged in to.

#### Syntax

```powershell
Get-SalesforceConnections [-ShowVerboseDetails] [<CommonParameters>]
```

#### Description

Runs sf org list and returns one object per org. Every object has orgId, instanceUrl, username, connectedStatus, isDevHub, lastUsed and alias (empty when the CLI leaves one out), plus any of these the CLI reports: aliases, orgName, namespacePrefix, instanceApiVersion, isDefaultUsername, isDefaultDevHubUsername, defaultMarker, isSandbox, isScratch, loginUrl, oauthMethod, tracksSource and similar non-secret details. Only these named properties are copied, so the access token and other credentials in the CLI result are never returned. Scratch orgs are not included here; use Get-SalesforceScratchOrgs for those.

#### Parameters

- `-ShowVerboseDetails` (switch): List more information about each org. Adds --verbose.

#### Salesforce CLI

- `sf org list`

#### Examples

```powershell
PS> Get-SalesforceConnections | Format-Table username, alias, connectedStatus
PS> A quick overview of connected orgs.
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceConnections -Examples"
- For more information, type: "Get-Help Get-SalesforceConnections -Detailed"
- For technical information, type: "Get-Help Get-SalesforceConnections -Full"
- For online help, type: "Get-Help Get-SalesforceConnections -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Open-Salesforce

#### Synopsis

Opens an org in your browser, or prints its login URL.

#### Syntax

```powershell
Open-Salesforce [[-TargetOrg] <String>] [-UrlOnly] [[-Browser] <String>] [-BrowserPrivateMode] [[-Path] <String>] [[-SourceFile] <String>] [<CommonParameters>]
```

#### Description

Runs sf org open. The URL contains a session token, so treat it like a password; -UrlOnly prints it instead of opening a browser.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-UrlOnly` (switch): Display navigation URL, but don't launch browser. Adds --url-only.
- `-Browser` (String): Browser where the org opens. Passed to sf as --browser. Valid values: chrome, edge, firefox.
- `-BrowserPrivateMode` (switch): Open the org in the browser's private (incognito) mode. A switch: adds --private, which takes no value.
- `-Path` (String): Page to open, relative to the org, for example /lightning/setup/SetupOneHome/home. Passed to sf as --path.
- `-SourceFile` (String): Path of a local file in the project. The CLI opens that component in the org, for example a Lightning page in the builder or an Apex class in the viewer. Passed to sf as --source-file. The file must exist.

#### Salesforce CLI

- `sf org open`

#### Examples

```powershell
PS> Open-Salesforce -TargetOrg dev1
```

Open the org in the default browser.

#### Remarks

- To see the examples, type: "Get-Help Open-Salesforce -Examples"
- For more information, type: "Get-Help Open-Salesforce -Detailed"
- For technical information, type: "Get-Help Open-Salesforce -Full"
- For online help, type: "Get-Help Open-Salesforce -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceAlias

#### Synopsis

Removes one org alias, or all of them, from this computer.

#### Syntax

```powershell
Remove-SalesforceAlias [[-Alias] <String>] [-All] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf alias unset. Only the local aliases are removed; the orgs are not touched. Give -Alias to remove one, or -All to remove every alias, which asks for confirmation first because it cannot be undone. Supports -WhatIf. -NoPrompt skips the question so a script can run unattended; psfdx always passes --no-prompt to the CLI itself after it has asked, so the CLI never waits for an answer.

#### Parameters

- `-Alias` (String): The alias to remove. Required unless -All is given.
- `-All` (switch): Remove all the aliases that are set. Cannot be used with -Alias. Adds --all.
- `-NoPrompt` (switch): Do not ask for confirmation when removing all the aliases. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf alias unset`

#### Examples

```powershell
PS> Remove-SalesforceAlias -Alias dev1
```

Remove the alias dev1.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceAlias -Examples"
- For more information, type: "Get-Help Remove-SalesforceAlias -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceAlias -Full"
- For online help, type: "Get-Help Remove-SalesforceAlias -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Repair-SalesforceConnections

#### Synopsis

Removes expired and deleted orgs from the list of connections.

#### Syntax

```powershell
Repair-SalesforceConnections [-NoPrompt] [<CommonParameters>]
```

#### Description

Runs sf org list --clean, which checks every org and offers to remove the ones that no longer exist or whose scratch org has expired. Without -NoPrompt the CLI asks first. It returns the CLI's text output.

#### Parameters

- `-NoPrompt` (switch): Don't prompt for confirmation. Adds --no-prompt.

#### Salesforce CLI

- `sf org list`

#### Examples

```powershell
PS> Repair-SalesforceConnections
```

Interactive clean-up.

#### Remarks

- To see the examples, type: "Get-Help Repair-SalesforceConnections -Examples"
- For more information, type: "Get-Help Repair-SalesforceConnections -Detailed"
- For technical information, type: "Get-Help Repair-SalesforceConnections -Full"
- For online help, type: "Get-Help Repair-SalesforceConnections -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## SOQL helpers

### ConvertTo-SalesforceSoqlDateTime

#### Synopsis

Formats a DateTime as a SOQL datetime literal in UTC, for example 2026-11-18T11:00:00Z.

#### Syntax

```powershell
ConvertTo-SalesforceSoqlDateTime [-Value] <DateTime> [[-TimeZone] <TimeZoneInfo>] [<CommonParameters>]
```

#### Description

Formats a DateTime as a SOQL datetime literal in UTC, for example 2026-11-18T11:00:00Z. It is not quoted.

The value is converted to UTC before the Z is written, so the literal is the same instant whatever the machine's time zone: Kind Utc used as it is Kind Local converted from the machine's local time zone, including daylight saving time Kind Unspecified treated as local time, the same as .NET's ToUniversalTime() does. A date parsed from text such as '2026-11-18 12:00' is Unspecified, so it means 12:00 where you are. -TimeZone names the zone to read a Local or Unspecified value in instead of the machine's. A time that does not exist in that zone (the hour skipped when the clocks go forward) is refused. A time that happens twice (the hour repeated when the clocks go back) is read as standard time, as .NET does. Fractions of a second are dropped, as the old 's' format did. 's' is culture-invariant.

#### Parameters

- `-Value` (DateTime, required): The date and time to format. A Local or Unspecified kind is read as local time and converted to UTC. Accepts pipeline input. Required. Accepts input from the pipeline.
- `-TimeZone` (TimeZoneInfo): Time zone to read an unspecified value in, for example Europe/London, instead of the computer's zone.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> ConvertTo-SalesforceSoqlDateTime -Value my-org
```

Runs ConvertTo-SalesforceSoqlDateTime with its required parameters.

#### Remarks

- To see the examples, type: "Get-Help ConvertTo-SalesforceSoqlDateTime -Examples"
- For more information, type: "Get-Help ConvertTo-SalesforceSoqlDateTime -Detailed"
- For technical information, type: "Get-Help ConvertTo-SalesforceSoqlDateTime -Full"
- For online help, type: "Get-Help ConvertTo-SalesforceSoqlDateTime -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### ConvertTo-SalesforceSoqlIdentifier

#### Synopsis

Checks that a value is a plain Salesforce object or field API name (letters, digits and underscores, starting with a letter, with optional dots for relationships) and returns it.

#### Syntax

```powershell
ConvertTo-SalesforceSoqlIdentifier [-Value] <String> [<CommonParameters>]
```

#### Description

Checks that a value is a plain Salesforce object or field API name (letters, digits and underscores, starting with a letter, with optional dots for relationships) and returns it. Identifiers cannot be quoted in SOQL, so anything else is refused instead of being placed in the query.

#### Parameters

- `-Value` (String, required): An object or field API name (letters, digits and underscores, with optional dots for relationships). Anything else makes the cmdlet throw. Accepts pipeline input. Required. Accepts input from the pipeline.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> ConvertTo-SalesforceSoqlIdentifier -Value my-org
```

Runs ConvertTo-SalesforceSoqlIdentifier with its required parameters.

#### Remarks

- To see the examples, type: "Get-Help ConvertTo-SalesforceSoqlIdentifier -Examples"
- For more information, type: "Get-Help ConvertTo-SalesforceSoqlIdentifier -Detailed"
- For technical information, type: "Get-Help ConvertTo-SalesforceSoqlIdentifier -Full"
- For online help, type: "Get-Help ConvertTo-SalesforceSoqlIdentifier -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### ConvertTo-SalesforceSoqlLiteral

#### Synopsis

Turns a value into a quoted SOQL string literal that is safe to place in a generated query.

#### Syntax

```powershell
ConvertTo-SalesforceSoqlLiteral [-Value] <String> [-Like] [<CommonParameters>]
```

#### Description

Turns a value into a quoted SOQL string literal that is safe to place in a generated query.

SOQL escapes a string with a backslash, not by doubling the quote: O'Brien is 'O\'Brien'. Backslash, apostrophe and double quote are escaped. Line breaks, tabs, backspace and form feed become \n \r \t \b \f, so a value never puts a real line break into the query. Any other control character is refused rather than guessed at. Unicode text is kept as it is.

With -Like, % and _ are escaped as well so they match themselves; without it they are left alone, because they are ordinary characters in an = comparison.

The result is also safe inside the double-quoted --query "..." argument that psfdx builds: a double quote or a backtick gets the command-line escape that ConvertTo-PsfdxArgumentList understands. Caller-authored queries passed to Select-SalesforceRecords -Query are not touched by this.

#### Parameters

- `-Value` (String, required): The text to turn into a quoted SOQL string. Quotes and backslashes are escaped; control characters other than line breaks and tabs are refused. Accepts pipeline input. Required. Accepts input from the pipeline.
- `-Like` (switch): Also escape % and _ so they match themselves inside a LIKE pattern.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> ConvertTo-SalesforceSoqlLiteral -Value my-org
```

Runs ConvertTo-SalesforceSoqlLiteral with its required parameters.

#### Remarks

- To see the examples, type: "Get-Help ConvertTo-SalesforceSoqlLiteral -Examples"
- For more information, type: "Get-Help ConvertTo-SalesforceSoqlLiteral -Detailed"
- For technical information, type: "Get-Help ConvertTo-SalesforceSoqlLiteral -Full"
- For online help, type: "Get-Help ConvertTo-SalesforceSoqlLiteral -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## APIs

### Get-SalesforceApiUsage

#### Synopsis

Shows how much of the daily API request limit an org has used.

#### Syntax

```powershell
Get-SalesforceApiUsage [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Reads the org limits with Get-SalesforceLimits and returns the DailyApiRequests entry with a Usage percentage added (used divided by max). Returns nothing if the org does not report that limit.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org to check. If omitted, the Salesforce CLI uses the default target org (passed on to Get-SalesforceLimits).

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceApiUsage -TargetOrg prod
```

See the API usage of the production org.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceApiUsage -Examples"
- For more information, type: "Get-Help Get-SalesforceApiUsage -Detailed"
- For technical information, type: "Get-Help Get-SalesforceApiUsage -Full"
- For online help, type: "Get-Help Get-SalesforceApiUsage -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceApiVersions

#### Synopsis

Lists the REST API versions the org supports.

#### Syntax

```powershell
Get-SalesforceApiVersions [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Sends a GET request to /services/data with sf api request rest and returns the list of versions as objects (label, url, version).

#### Parameters

- `-TargetOrg` (String): 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 api request rest`

#### Examples

```powershell
PS> Get-SalesforceApiVersions -TargetOrg dev1 | Select-Object -Last 1
```

The newest API version of the org.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceApiVersions -Examples"
- For more information, type: "Get-Help Get-SalesforceApiVersions -Detailed"
- For technical information, type: "Get-Help Get-SalesforceApiVersions -Full"
- For online help, type: "Get-Help Get-SalesforceApiVersions -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-api>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceLatestApiVersion

#### Synopsis

Returns the newest REST API version the org supports, such as v62.0.

#### Syntax

```powershell
Get-SalesforceLatestApiVersion [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Calls Get-SalesforceApiVersions and returns the highest version prefixed with v. Returns nothing if the org reports no versions.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org to ask. If omitted, the Salesforce CLI uses the default target org (passed on to Get-SalesforceApiVersions).

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceLatestApiVersion -TargetOrg dev1
```

For example v62.0.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceLatestApiVersion -Examples"
- For more information, type: "Get-Help Get-SalesforceLatestApiVersion -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLatestApiVersion -Full"
- For online help, type: "Get-Help Get-SalesforceLatestApiVersion -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceApi

#### Synopsis

Calls a Salesforce REST API URL with an access token.

#### Syntax

```powershell
Invoke-SalesforceApi [-Url] <String> [-AccessToken] <String> [[-Method] <String>] [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI. It sends the request with Invoke-RestMethod and an Authorization: Bearer header, and returns the parsed response. The URL must be absolute and https, so the token is never sent over plain http. You choose the host; the cmdlet does not check that it is a Salesforce host.

#### Parameters

- `-Url` (String, required): Absolute https:// URL of the REST resource. Required.
- `-AccessToken` (String, required): Access token to send as the bearer token, for example from Connect-SalesforceApi. Required.
- `-Method` (String): HTTP method: GET (default), POST, PATCH or DELETE. Default: "GET". Valid values: GET, POST, PATCH, DELETE.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Invoke-SalesforceApi -Url https://example.my.salesforce.com/services/data -AccessToken $token
```

List the API versions of an org.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceApi -Examples"
- For more information, type: "Get-Help Invoke-SalesforceApi -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceApi -Full"
- For online help, type: "Get-Help Invoke-SalesforceApi -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceGraphQL

#### Synopsis

Runs a GraphQL statement against an org with the CLI's login.

#### Syntax

```powershell
Invoke-SalesforceGraphQL [[-Query] <String>] [[-QueryFile] <String>] [-Include] [[-StreamToFile] <String>] [-AsObject] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf api request graphql, which sends a GraphQL query or mutation to the Salesforce GraphQL API as the user you are logged in as. Give the statement as -Query, or put it in a file and give -QueryFile. The response is returned as text, or as an object with -AsObject. A mutation changes data, so a statement that starts with mutation asks for confirmation and supports -WhatIf; a query does not. A response the server marks as an error makes the cmdlet throw (PsfdxRequestFailed). On Windows the CLI's .cmd launcher cannot take a statement with a double quote or a line break, so use -QueryFile there.

#### Parameters

- `-Query` (String): The GraphQL statement. Use it or -QueryFile. Passed to sf as --body.
- `-QueryFile` (String): Path of a file that holds the GraphQL statement. It must exist. Use it or -Query. Passed to sf as --body.
- `-Include` (switch): Include the HTTP status and headers in the output. Adds --include.
- `-StreamToFile` (String): Write the response to this file instead of returning it. Cannot be used with -Include or -AsObject. Passed to sf as --stream-to-file.
- `-AsObject` (switch): Return the response converted from JSON instead of text. Not with -Include or -StreamToFile.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf api request graphql`

#### Examples

```powershell
PS> Invoke-SalesforceGraphQL -Query 'query { uiapi { query { Account { edges { node { Id Name { value } } } } } } }' -AsObject -TargetOrg dev1
```

Query accounts and get an object.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceGraphQL -Examples"
- For more information, type: "Get-Help Invoke-SalesforceGraphQL -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceGraphQL -Full"
- For online help, type: "Get-Help Invoke-SalesforceGraphQL -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-api>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceRestRequest

#### Synopsis

Makes an authenticated Salesforce REST API request with the CLI's login.

#### Syntax

```powershell
Invoke-SalesforceRestRequest [[-Url] <String>] [[-Method] <String>] [[-Body] <String>] [[-BodyFile] <String>] [[-File] <String>] [[-Header] <IDictionary>] [-Include] [[-StreamToFile] <String>] [-AsObject] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf api request rest, which calls any REST endpoint as the user you are logged in as, so you need no token. The response is returned as text, or as an object with -AsObject. A request that changes data (POST, PUT, PATCH or DELETE) asks for confirmation and supports -WhatIf; a read does not. An error response makes the cmdlet throw (PsfdxRequestFailed). Give the body as -Body, as a file with -BodyFile, or give the whole request (URL, method, headers and body) in a JSON -File. On Windows the CLI's .cmd launcher cannot take a body with a double quote, which JSON always has, so use -BodyFile or -File there. For the other psfdx REST helpers see Invoke-SalesforceApi, which uses an access token instead.

#### Parameters

- `-Url` (String): The endpoint, for example /services/data/v62.0/limits. Not needed if -File holds it. It is an argument of the command, not a flag.
- `-Method` (String): HTTP method. Valid values: GET, POST, PUT, PATCH, HEAD, DELETE, OPTIONS, TRACE. The CLI default is GET. Passed to sf as --method.
- `-Body` (String): The request body as text. Use one of -Body, -BodyFile and -File. Passed to sf as --body.
- `-BodyFile` (String): Path of a file that holds the request body. It must exist. The cmdlet sends it as --body @path. Use one of -Body, -BodyFile and -File.
- `-File` (String): Path of a JSON file that holds the URL, method, headers and body. It must exist. Use one of -Body, -BodyFile and -File. Passed to sf as --file.
- `-Header` (IDictionary): HTTP headers as name and value pairs. Each is passed to sf as its own --header name:value. Names are checked and a value may not contain a line break. Passed to sf as --header.
- `-Include` (switch): Include the HTTP status and headers in the output. Cannot be used with -StreamToFile or -AsObject. Adds --include.
- `-StreamToFile` (String): Write the response to this file instead of returning it. Cannot be used with -Include or -AsObject. Passed to sf as --stream-to-file.
- `-AsObject` (switch): Return the response converted from JSON instead of text.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf api request rest`

#### Examples

```powershell
PS> Invoke-SalesforceRestRequest -Url /services/data/v62.0/limits -AsObject -TargetOrg dev1
```

Read the org limits as an object.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceRestRequest -Examples"
- For more information, type: "Get-Help Invoke-SalesforceRestRequest -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceRestRequest -Full"
- For online help, type: "Get-Help Invoke-SalesforceRestRequest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-api>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Experience Cloud

### Get-SalesforceCommunityTemplates

#### Synopsis

Lists the Experience Cloud site templates available in an org.

#### Syntax

```powershell
Get-SalesforceCommunityTemplates [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf community list template and returns one object per template. Use a template name with New-SalesforceCommunity. It only reads.

#### Parameters

- `-TargetOrg` (String): 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 community list template`

#### Examples

```powershell
PS> Get-SalesforceCommunityTemplates -TargetOrg dev1
```

The templates the org offers.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceCommunityTemplates -Examples"
- For more information, type: "Get-Help Get-SalesforceCommunityTemplates -Detailed"
- For technical information, type: "Get-Help Get-SalesforceCommunityTemplates -Full"
- For online help, type: "Get-Help Get-SalesforceCommunityTemplates -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-community>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCommunity

#### Synopsis

Creates an Experience Cloud site in an org from a template.

#### Syntax

```powershell
New-SalesforceCommunity [-Name] <String> [-TemplateName] <String> [[-UrlPathPrefix] <String>] [[-Description] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf community create. The site is created in the org, as a draft that is not live yet; make it live with Publish-SalesforceCommunity. Digital Experiences must be turned on in the org. Supports -WhatIf and -Confirm; it does not prompt by default. To write the files of a site into a project instead, use New-SalesforceExperienceSite.

#### Parameters

- `-Name` (String, required): Name of the site. Passed to sf as --name. Required.
- `-TemplateName` (String, required): Template to build the site from, as listed by Get-SalesforceCommunityTemplates. Passed to sf as --template-name. Required.
- `-UrlPathPrefix` (String): URL path prefix of the site, appended to the domain of the org. Letters and digits only. Passed to sf as --url-path-prefix.
- `-Description` (String): Description of the site. Passed to sf as --description.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf community create`

#### Examples

```powershell
PS> New-SalesforceCommunity -Name 'Partner Portal' -TemplateName 'Customer Service' -UrlPathPrefix partners -TargetOrg dev1 -WhatIf
```

Preview creating a site.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCommunity -Examples"
- For more information, type: "Get-Help New-SalesforceCommunity -Detailed"
- For technical information, type: "Get-Help New-SalesforceCommunity -Full"
- For online help, type: "Get-Help New-SalesforceCommunity -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-community>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Publish-SalesforceCommunity

#### Synopsis

Publishes an Experience Builder site to make its changes live.

#### Syntax

```powershell
Publish-SalesforceCommunity [-Name] <String> [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf community publish. Publishing makes the current draft of the site visible to its visitors, and it cannot be taken back with one command. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-Name` (String, required): Name of the site to publish. Passed to sf as --name. Required.
- `-NoPrompt` (switch): 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.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf community publish`

#### Examples

```powershell
PS> Publish-SalesforceCommunity -Name 'Partner Portal' -TargetOrg dev1 -WhatIf
```

Preview publishing the site.

#### Remarks

- To see the examples, type: "Get-Help Publish-SalesforceCommunity -Examples"
- For more information, type: "Get-Help Publish-SalesforceCommunity -Detailed"
- For technical information, type: "Get-Help Publish-SalesforceCommunity -Full"
- For online help, type: "Get-Help Publish-SalesforceCommunity -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-community>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Tools and org information

### Get-SalesforceDataStorage

#### Synopsis

Shows how much data storage an org has used.

#### Syntax

```powershell
Get-SalesforceDataStorage [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Reads the org limits with Get-SalesforceLimits and returns the DataStorageMB entry with InUse and Usage (percentage) added. Returns nothing if the org does not report that limit.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org to check. If omitted, the Salesforce CLI uses the default target org (passed on to Get-SalesforceLimits).

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceDataStorage -TargetOrg prod
```

Data storage used, in MB and as a percentage.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDataStorage -Examples"
- For more information, type: "Get-Help Get-SalesforceDataStorage -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDataStorage -Full"
- For online help, type: "Get-Help Get-SalesforceDataStorage -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDateTime

#### Synopsis

Formats a date and time as a SOQL datetime literal.

#### Syntax

```powershell
Get-SalesforceDateTime [[-Datetime] <DateTime>] [<CommonParameters>]
```

#### Description

Returns the value in UTC as 2026-11-18T11:00:00Z, ready to use in a SOQL WHERE clause. With no value it uses the current time. A local or unspecified time is converted to UTC first. It is a thin wrapper over ConvertTo-SalesforceSoqlDateTime.

#### Parameters

- `-Datetime` (DateTime): The moment to format. Defaults to now. A local or unspecified kind is read as local time and converted to UTC.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceDateTime (Get-Date).AddDays(-1)
PS> Yesterday, as a literal for a CreatedDate filter.
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDateTime -Examples"
- For more information, type: "Get-Help Get-SalesforceDateTime -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDateTime -Full"
- For online help, type: "Get-Help Get-SalesforceDateTime -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceLimits

#### Synopsis

Shows the org's limits and how much of each is left.

#### Syntax

```powershell
Get-SalesforceLimits [[-TargetOrg] <String>] [[-Threshold] <Double>] [<CommonParameters>]
```

#### Description

Runs sf org list limits and returns one object per limit with the name, max and remaining values the CLI reports, plus two calculated properties: Used is max minus remaining, in the limit's own unit (requests, MB, emails and so on). UsedPercent is Used as a percentage of max (0 to 100, a number rounded to two decimal places, not a string). When max is 0, missing or not a number (an unlimited, disabled or unknown limit), Used and UsedPercent are $null rather than a guess. Use -Threshold to return only the limits whose UsedPercent is at or above a value; limits with no UsedPercent are left out.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-Threshold` (Double): Optional. A percentage from 0 to 100. Returns only the limits whose UsedPercent is greater than or equal to this value (the boundary is inclusive). Limits with an unknown UsedPercent are not returned. Applied by psfdx; no CLI flag.

#### Salesforce CLI

- `sf org list limits`

#### Examples

```powershell
PS> Get-SalesforceLimits -TargetOrg prod -Threshold 80 | Sort-Object UsedPercent -Descending | Select-Object name, Used, max, UsedPercent
```

Limits that are 80% or more used, highest first.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceLimits -Examples"
- For more information, type: "Get-Help Get-SalesforceLimits -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLimits -Full"
- For online help, type: "Get-Help Get-SalesforceLimits -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-limits>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceOrgDetails

#### Synopsis

Shows the details of one org: its ID, instance URL, user name, status and API version.

#### Syntax

```powershell
Get-SalesforceOrgDetails [[-TargetOrg] <String>] [-ShowVerboseDetails] [-IncludeToken] [<CommonParameters>]
```

#### Description

Runs sf org display. The result has the access token and the Salesforce DX authorization URL removed, so the output is safe to log or share, unless you pass -IncludeToken. Anyone who has the token or the URL can act as that user, so only use -IncludeToken when you need it.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-ShowVerboseDetails` (switch): Include more details, such as the Salesforce DX authorization URL (removed again unless you pass -IncludeToken). Adds --verbose.
- `-IncludeToken` (switch): Return the CLI result as it is, with accessToken and sfdxAuthUrl. Without it psfdx removes accessToken, refreshToken, sfdxAuthUrl, password, clientSecret and privateKey from the result.

#### Salesforce CLI

- `sf org display`

#### Examples

```powershell
PS> Get-SalesforceOrgDetails -TargetOrg dev1
```

Show the org ID, instance URL and status of dev1, without any token.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceOrgDetails -Examples"
- For more information, type: "Get-Help Get-SalesforceOrgDetails -Detailed"
- For technical information, type: "Get-Help Get-SalesforceOrgDetails -Full"
- For online help, type: "Get-Help Get-SalesforceOrgDetails -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Install-SalesforceCli

#### Synopsis

Installs the Salesforce CLI globally with npm.

#### Syntax

```powershell
Install-SalesforceCli [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs npm install --global @salesforce/cli. This downloads and runs code from the npm registry. Node.js and npm must already be installed. Asks nothing by default, supports -WhatIf and -Confirm.

Commands that use sf check for Salesforce CLI v2 or newer when first needed. If sf is missing, set PSFDX_CLI_INSTALL to Prompt for an interactive confirmation, or Install to authorize unattended npm installation. The default is Never. Bootstrap can refresh the current session's PATH from npm and does not upgrade a CLI it finds.

#### Parameters

- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Install-SalesforceCli -WhatIf
```

Show what would be installed.

#### Remarks

- To see the examples, type: "Get-Help Install-SalesforceCli -Examples"
- For more information, type: "Get-Help Install-SalesforceCli -Detailed"
- For technical information, type: "Get-Help Install-SalesforceCli -Full"
- For online help, type: "Get-Help Install-SalesforceCli -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceDoctor

#### Synopsis

Runs the Salesforce CLI diagnostics and writes a report of its setup and problems.

#### Syntax

```powershell
Invoke-SalesforceDoctor [[-Command] <String>] [[-Plugin] <String>] [[-OutputDirectory] <String>] [-CreateIssue] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf doctor, which gathers the CLI's configuration and runs checks to find problems in your environment. The results are written to files in the output folder. With -Command it also runs that command in debug mode and logs it. -CreateIssue goes further: it opens a new issue on the Salesforce CLI's GitHub repository with the diagnostic results attached, which shares information about your machine outside it, so it asks for confirmation first. Supports -WhatIf and -Confirm.

#### Parameters

- `-Command` (String): A CLI command to run in debug mode, for example 'org list'. Its results go to a log file. Passed to sf as --command.
- `-Plugin` (String): Only run the diagnostics of this plugin. Passed to sf as --plugin.
- `-OutputDirectory` (String): Folder to save the created files in, instead of the current folder. It must exist. Passed to sf as --output-dir.
- `-CreateIssue` (switch): Create a new issue on the Salesforce CLI's GitHub repository with the diagnostic results attached. Asks for confirmation first. Adds --create-issue.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf doctor`

#### Examples

```powershell
PS> Invoke-SalesforceDoctor -OutputDirectory .\doctor
```

Run the diagnostics and keep the files in a folder.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceDoctor -Examples"
- For more information, type: "Get-Help Invoke-SalesforceDoctor -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceDoctor -Full"
- For online help, type: "Get-Help Invoke-SalesforceDoctor -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-info>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceCli

#### Synopsis

Updates the Salesforce CLI installed with npm.

#### Syntax

```powershell
Update-SalesforceCli [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs npm update --global @salesforce/cli. It downloads and runs code from the npm registry. Supports -WhatIf and -Confirm.

#### Parameters

- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Update-SalesforceCli -WhatIf
```

Show what would be updated.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceCli -Examples"
- For more information, type: "Get-Help Update-SalesforceCli -Detailed"
- For technical information, type: "Get-Help Update-SalesforceCli -Full"
- For online help, type: "Get-Help Update-SalesforceCli -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Users and permissions

### Get-SalesforceOrgUser

#### Synopsis

Shows the user the CLI is signed in as in an org (sf org display user).

#### Syntax

```powershell
Get-SalesforceOrgUser [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

The access token and password are never returned: current Salesforce CLI versions replace both with a redaction message in this command, so there is nothing real to return. HasPassword says whether the CLI holds a password for the user. To set a known password, use New-SalesforceUserPassword.

#### Parameters

- `-TargetOrg` (String): 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 org display user`

#### Examples

```powershell
PS> Get-SalesforceOrgUser -TargetOrg myscratch
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceOrgUser -Examples"
- For more information, type: "Get-Help Get-SalesforceOrgUser -Detailed"
- For technical information, type: "Get-Help Get-SalesforceOrgUser -Full"
- For online help, type: "Get-Help Get-SalesforceOrgUser -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceUsers

#### Synopsis

Lists users of an org, newest login first.

#### Syntax

```powershell
Get-SalesforceUsers [[-Username] <String>] [-ActiveOnly] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Queries User (Id, Name, Username, Email, IsActive, LastLoginDate) through Select-SalesforceRecords, ordered by LastLoginDate descending. Values are escaped as SOQL literals.

#### Parameters

- `-Username` (String): Return only the user with this exact user name.
- `-ActiveOnly` (switch): Return only active users.
- `-Limit` (Int32): Maximum number of users to return. Default 200. Default: 200.
- `-TargetOrg` (String): Username or alias of the org to query. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceUsers -ActiveOnly -Limit 20 -TargetOrg prod
```

The 20 most recently active users.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceUsers -Examples"
- For more information, type: "Get-Help Get-SalesforceUsers -Detailed"
- For technical information, type: "Get-Help Get-SalesforceUsers -Full"
- For online help, type: "Get-Help Get-SalesforceUsers -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Grant-SalesforcePermissionSet

#### Synopsis

Assigns permission sets to users (sf org assign permset).

#### Syntax

```powershell
Grant-SalesforcePermissionSet [-Name] <String[]> [[-OnBehalfOf] <String[]>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Without -OnBehalfOf the permission sets go to the target org's own user. Returns one object per user and permission set with Status Assigned or AlreadyAssigned; assigning a set the user already has is not an error, so a script can run again safely. Failures (a missing set, no permission) are returned with Status Failed and the cmdlet then throws PsfdxPermissionAssignmentFailed, whose TargetObject lists them. Asks for confirmation by default; -WhatIf makes no CLI call. Needs the Assign Permission Sets permission.

#### Parameters

- `-Name` (String[], required): Names of the permission sets to assign, one per value (a value may not contain a comma). Passed to sf as --name, one flag per name. Required.
- `-OnBehalfOf` (String[]): Usernames or aliases of the users to assign the permission sets to, one per value (a value may not contain a comma). Passed to sf as --on-behalf-of, one flag per user. When omitted, the target org's own user gets them.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org assign permset`

#### Examples

```powershell
PS> Grant-SalesforcePermissionSet -Name Sales_Admin, Reports_User -OnBehalfOf qa1, qa2 -TargetOrg myscratch -Confirm:$false
```

#### Remarks

- To see the examples, type: "Get-Help Grant-SalesforcePermissionSet -Examples"
- For more information, type: "Get-Help Grant-SalesforcePermissionSet -Detailed"
- For technical information, type: "Get-Help Grant-SalesforcePermissionSet -Full"
- For online help, type: "Get-Help Grant-SalesforcePermissionSet -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Grant-SalesforcePermissionSetLicense

#### Synopsis

Assigns permission set licenses to users (sf org assign permsetlicense).

#### Syntax

```powershell
Grant-SalesforcePermissionSetLicense [-Name] <String[]> [[-OnBehalfOf] <String[]>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Results, idempotency, failures and confirmation work as for Grant-SalesforcePermissionSet. The org must have the licence available.

Supports -WhatIf and -Confirm and asks for confirmation by default.

#### Parameters

- `-Name` (String[], required): Names of the permission set licenses to assign, one per value (a value may not contain a comma). Passed to sf as --name, one flag per name. Required.
- `-OnBehalfOf` (String[]): Usernames or aliases of the users to assign the licenses to, one per value (a value may not contain a comma). Passed to sf as --on-behalf-of, one flag per user. When omitted, the target org's own user gets them.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org assign permsetlicense`

#### Examples

```powershell
PS> Grant-SalesforcePermissionSetLicense -Name SalesforceCPQ_Admin -OnBehalfOf qa1 -TargetOrg myscratch -Confirm:$false
```

#### Remarks

- To see the examples, type: "Get-Help Grant-SalesforcePermissionSetLicense -Examples"
- For more information, type: "Get-Help Grant-SalesforcePermissionSetLicense -Detailed"
- For technical information, type: "Get-Help Grant-SalesforcePermissionSetLicense -Full"
- For online help, type: "Get-Help Grant-SalesforcePermissionSetLicense -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceUser

#### Synopsis

Creates a user in an org and authorises it in the CLI (sf org create user).

#### Syntax

```powershell
New-SalesforceUser [[-DefinitionFile] <String>] [[-Field] <IDictionary>] [[-SetAlias] <String>] [-SetUniqueUsername] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Give the user's fields in a definition file (-DefinitionFile), in -Field, or both; fields in -Field override the file. Asks for confirmation only when $ConfirmPreference is Medium or lower, and -WhatIf makes no CLI call. Field values go to the CLI as separate arguments, so quotes and spaces need no escaping, but a value with a double quote or a line break is rejected by the Windows CLI shim. Needs the Manage Users permission. The CLI creates users for scratch orgs and sandboxes it can sign in to.

#### Parameters

- `-DefinitionFile` (String): File path to a user definition file for customizing the new user. Passed to sf as --definition-file.
- `-Field` (IDictionary): Hashtable of user field values, for example @{ username = 'qa1@example.org'; profileName = 'Standard User' }. Each key=value is passed to the CLI as a separate argument, and a value here overrides the same field in -DefinitionFile.
- `-SetAlias` (String): Set an alias for the created username to reference in other CLI commands. Passed to sf as --set-alias.
- `-SetUniqueUsername` (switch): Force the username, if specified in the definition file or at the command line, to be unique by appending the org ID. Adds --set-unique-username.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org create user`

#### Examples

```powershell
PS> New-SalesforceUser -Field @{ username = 'qa1@example.org'; profileName = 'Standard User'; lastName = 'QA' } -SetAlias qa1 -TargetOrg myscratch
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceUser -Examples"
- For more information, type: "Get-Help New-SalesforceUser -Detailed"
- For technical information, type: "Get-Help New-SalesforceUser -Full"
- For online help, type: "Get-Help New-SalesforceUser -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceUserPassword

#### Synopsis

Generates a new password for a user and returns it as a SecureString (sf org generate password).

#### Syntax

```powershell
New-SalesforceUserPassword [[-OnBehalfOf] <String>] [[-Length] <Int32>] [[-Complexity] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

This changes the user's password, so it asks for confirmation by default; -WhatIf makes no CLI call. The password is returned only as a SecureString in Password, and is never written to -Verbose, -Debug or error output by this cmdlet. Length is 20 to 1000 and complexity 3 to 5 (higher is stronger), as the CLI allows. One user at a time (-OnBehalfOf takes a single username or alias). Needs the Manage Users and Reset User Passwords and Unlock Users permissions.

#### Parameters

- `-OnBehalfOf` (String): Comma-separated list of usernames or aliases to assign the password to; must have been created locally with the "org create user" command. Passed to sf as --on-behalf-of.
- `-Length` (Int32): Number of characters in the generated password; valid values are between 20 and 1000. Default value is 20. Passed to sf as --length. Default: 20. Range: 20 to 1000.
- `-Complexity` (Int32): Level of password complexity or strength; the higher the value, the stronger the password. Passed to sf as --complexity. Default: 5. Range: 3 to 5.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org generate password`

#### Examples

```powershell
PS> $p = New-SalesforceUserPassword -OnBehalfOf qa1 -TargetOrg myscratch -Confirm:$false; $p.Username
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceUserPassword -Examples"
- For more information, type: "Get-Help New-SalesforceUserPassword -Detailed"
- For technical information, type: "Get-Help New-SalesforceUserPassword -Full"
- For online help, type: "Get-Help New-SalesforceUserPassword -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-user>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-agentforce command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-agentforce/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

44 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Data libraries**: [Add-SalesforceAgentDataLibraryFile](#add-salesforceagentdatalibraryfile), [Get-SalesforceAgentDataLibraries](#get-salesforceagentdatalibraries), [Get-SalesforceAgentDataLibrary](#get-salesforceagentdatalibrary), [Get-SalesforceAgentDataLibraryFiles](#get-salesforceagentdatalibraryfiles), [Get-SalesforceAgentDataLibraryStatus](#get-salesforceagentdatalibrarystatus), [New-SalesforceAgentDataLibrary](#new-salesforceagentdatalibrary), [Remove-SalesforceAgentDataLibrary](#remove-salesforceagentdatalibrary), [Remove-SalesforceAgentDataLibraryFile](#remove-salesforceagentdatalibraryfile), [Send-SalesforceAgentDataLibraryFile](#send-salesforceagentdatalibraryfile), [Update-SalesforceAgentDataLibrary](#update-salesforceagentdatalibrary)

**Agent setup and authoring**: [Disable-SalesforceAgent](#disable-salesforceagent), [Enable-SalesforceAgent](#enable-salesforceagent), [New-SalesforceAgent](#new-salesforceagent), [New-SalesforceAgentAuthoringBundle](#new-salesforceagentauthoringbundle), [New-SalesforceAgentSpecification](#new-salesforceagentspecification), [New-SalesforceAgentTemplate](#new-salesforceagenttemplate), [New-SalesforceAgentUser](#new-salesforceagentuser), [Open-SalesforceAgent](#open-salesforceagent), [Publish-SalesforceAgentAuthoringBundle](#publish-salesforceagentauthoringbundle), [Test-SalesforceAgentAuthoringBundle](#test-salesforceagentauthoringbundle), [Test-SalesforceAgentPlugin](#test-salesforceagentplugin)

**Preview and traces**: [Get-SalesforceAgentPreviewSessions](#get-salesforceagentpreviewsessions), [Get-SalesforceAgentTraces](#get-salesforceagenttraces), [Invoke-SalesforceAgentPreview](#invoke-salesforceagentpreview), [Read-SalesforceAgentTrace](#read-salesforceagenttrace), [Remove-SalesforceAgentTrace](#remove-salesforceagenttrace), [Send-SalesforceAgentPreviewMessage](#send-salesforceagentpreviewmessage), [Start-SalesforceAgentPreview](#start-salesforceagentpreview), [Stop-SalesforceAgentPreview](#stop-salesforceagentpreview)

**Tests and evaluations**: [Get-SalesforceAgentTestResult](#get-salesforceagenttestresult), [Get-SalesforceAgentTests](#get-salesforceagenttests), [New-SalesforceAgentTest](#new-salesforceagenttest), [New-SalesforceAgentTestSpecification](#new-salesforceagenttestspecification), [Resume-SalesforceAgentTest](#resume-salesforceagenttest), [Start-SalesforceAgentEvaluation](#start-salesforceagentevaluation), [Start-SalesforceAgentTest](#start-salesforceagenttest)

**MCP servers and assets**: [Get-SalesforceMcpAssets](#get-salesforcemcpassets), [Get-SalesforceMcpServer](#get-salesforcemcpserver), [Get-SalesforceMcpServerLiveAssets](#get-salesforcemcpserverliveassets), [Get-SalesforceMcpServers](#get-salesforcemcpservers), [New-SalesforceMcpServer](#new-salesforcemcpserver), [Remove-SalesforceMcpServer](#remove-salesforcemcpserver), [Set-SalesforceMcpAssets](#set-salesforcemcpassets), [Update-SalesforceMcpServer](#update-salesforcemcpserver)

## Data libraries

### Add-SalesforceAgentDataLibraryFile

#### Synopsis

Adds files to an existing data library.

#### Syntax

```powershell
Add-SalesforceAgentDataLibraryFile [-LibraryId] <String> [-Path] <String[]> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl file add for each path you give. Supports -WhatIf and -Confirm; it does not prompt by default. For an SFDRIVE library that you want to wait on, use Send-SalesforceAgentDataLibraryFile.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-Path` (String[], required): Files to add. Each is passed to sf as its own --path. Each must exist. Passed to sf as --path. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl file add`

#### Examples

```powershell
PS> Add-SalesforceAgentDataLibraryFile -LibraryId 1JDxx0000000001 -Path .\manual.pdf, .\faq.pdf -TargetOrg dev1
```

Add two files.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceAgentDataLibraryFile -Examples"
- For more information, type: "Get-Help Add-SalesforceAgentDataLibraryFile -Detailed"
- For technical information, type: "Get-Help Add-SalesforceAgentDataLibraryFile -Full"
- For online help, type: "Get-Help Add-SalesforceAgentDataLibraryFile -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentDataLibraries

#### Synopsis

Lists the Agentforce Data Libraries in an org.

#### Syntax

```powershell
Get-SalesforceAgentDataLibraries [[-SourceType] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent adl list and returns one object per library. It only reads.

#### Parameters

- `-SourceType` (String): Only libraries with this source. Valid values: sfdrive, knowledge, retriever. Passed to sf as --source-type.
- `-TargetOrg` (String): 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 agent adl list`

#### Examples

```powershell
PS> Get-SalesforceAgentDataLibraries -SourceType sfdrive -TargetOrg dev1
```

The file-based libraries.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentDataLibraries -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentDataLibraries -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentDataLibraries -Full"
- For online help, type: "Get-Help Get-SalesforceAgentDataLibraries -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentDataLibrary

#### Synopsis

Shows the details of one Agentforce Data Library.

#### Syntax

```powershell
Get-SalesforceAgentDataLibrary [-LibraryId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent adl get. It only reads.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-TargetOrg` (String): 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 agent adl get`

#### Examples

```powershell
PS> Get-SalesforceAgentDataLibrary -LibraryId 1JDxx0000000001 -TargetOrg dev1
```

The details of one library.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentDataLibrary -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentDataLibrary -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentDataLibrary -Full"
- For online help, type: "Get-Help Get-SalesforceAgentDataLibrary -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentDataLibraryFiles

#### Synopsis

Lists the files in a data library.

#### Syntax

```powershell
Get-SalesforceAgentDataLibraryFiles [-LibraryId] <String> [[-Status] <String>] [[-Offset] <Int32>] [[-PageSize] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent adl file list and returns one object per file, with its status. It only reads. Use -Offset and -PageSize to page through a big library.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-Status` (String): Only files with this status. Valid values: uploaded, indexing, indexed, index_failed, deleting, delete_failed. Passed to sf as --status.
- `-Offset` (Int32): Number of files to skip, for paging. Passed to sf as --offset.
- `-PageSize` (Int32): Number of files to return. Passed to sf as --page-size.
- `-TargetOrg` (String): 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 agent adl file list`

#### Examples

```powershell
PS> Get-SalesforceAgentDataLibraryFiles -LibraryId 1JDxx0000000001 -Status index_failed -TargetOrg dev1
```

The files that did not index.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentDataLibraryFiles -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentDataLibraryFiles -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentDataLibraryFiles -Full"
- For online help, type: "Get-Help Get-SalesforceAgentDataLibraryFiles -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentDataLibraryStatus

#### Synopsis

Shows the indexing status of a data library.

#### Syntax

```powershell
Get-SalesforceAgentDataLibraryStatus [-LibraryId] <String> [-IncludeArtifacts] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent adl status, which says whether the library's content is indexed and ready for an agent to use. It only reads.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-IncludeArtifacts` (switch): Also list the artifacts (indexes and related records) the indexing made. Adds --include-artifacts.
- `-TargetOrg` (String): 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 agent adl status`

#### Examples

```powershell
PS> Get-SalesforceAgentDataLibraryStatus -LibraryId 1JDxx0000000001 -TargetOrg dev1
PS> Is the library indexed yet?
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentDataLibraryStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentDataLibraryStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentDataLibraryStatus -Full"
- For online help, type: "Get-Help Get-SalesforceAgentDataLibraryStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentDataLibrary

#### Synopsis

Creates an Agentforce Data Library, the knowledge an agent is grounded in.

#### Syntax

```powershell
New-SalesforceAgentDataLibrary [-Name] <String> [-DeveloperName] <String> [-SourceType] <String> [[-Description] <String>] [[-IndexMode] <String>] [[-ContentFields] <String[]>] [[-DataCategoryIds] <String[]>] [[-DataCategoryNames] <String[]>] [[-PrimaryIndexField1] <String>] [[-PrimaryIndexField2] <String>] [[-RetrieverId] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl create. The source decides what the library holds: sfdrive (files you upload), knowledge (Salesforce Knowledge articles) or retriever (an existing retriever). Supports -WhatIf and -Confirm; it does not prompt by default. Without -WaitMinutes the CLI returns before indexing is done; check with Get-SalesforceAgentDataLibraryStatus.

#### Parameters

- `-Name` (String, required): Name (label) of the library. Passed to sf as --name. Required.
- `-DeveloperName` (String, required): API name of the library. Passed to sf as --developer-name. Required.
- `-SourceType` (String, required): Where the library's content comes from. Valid values: sfdrive, knowledge, retriever. Passed to sf as --source-type. Required.
- `-Description` (String): Description of the library. Passed to sf as --description.
- `-IndexMode` (String): How the content is indexed. Valid values: basic, enhanced. Passed to sf as --index-mode.
- `-ContentFields` (String[]): Knowledge fields to index. For a knowledge library. The values are joined with commas and passed as one --content-fields.
- `-DataCategoryIds` (String[]): IDs of the data categories to include. For a knowledge library. The values are joined with commas and passed as one --data-category-ids. Use it or -DataCategoryNames, not both.
- `-DataCategoryNames` (String[]): Names of the data categories to include. Qualified names such as Group_API_Name.Category, for a knowledge library. The values are joined with commas and passed as one --data-category-names. Use it or -DataCategoryIds, not both.
- `-PrimaryIndexField1` (String): First field of the primary index. For a retriever library. Passed to sf as --primary-index-field1.
- `-PrimaryIndexField2` (String): Second field of the primary index. For a retriever library. Passed to sf as --primary-index-field2.
- `-RetrieverId` (String): ID of the retriever. For a retriever library. Passed to sf as --retriever-id.
- `-WaitMinutes` (Int32): Number of minutes to wait for the library to be created. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl create`

#### Examples

```powershell
PS> New-SalesforceAgentDataLibrary -Name 'Product Manuals' -DeveloperName Product_Manuals -SourceType sfdrive -WaitMinutes 5 -TargetOrg dev1
```

Create a library for uploaded files.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentDataLibrary -Examples"
- For more information, type: "Get-Help New-SalesforceAgentDataLibrary -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentDataLibrary -Full"
- For online help, type: "Get-Help New-SalesforceAgentDataLibrary -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceAgentDataLibrary

#### Synopsis

Deletes an Agentforce Data Library.

#### Syntax

```powershell
Remove-SalesforceAgentDataLibrary [-LibraryId] <String> [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl delete. Agents that use the library lose that knowledge, and this cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-NoPrompt` (switch): 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.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl delete`

#### Examples

```powershell
PS> Remove-SalesforceAgentDataLibrary -LibraryId 1JDxx0000000001 -TargetOrg dev1 -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceAgentDataLibrary -Examples"
- For more information, type: "Get-Help Remove-SalesforceAgentDataLibrary -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceAgentDataLibrary -Full"
- For online help, type: "Get-Help Remove-SalesforceAgentDataLibrary -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceAgentDataLibraryFile

#### Synopsis

Deletes one file from a data library.

#### Syntax

```powershell
Remove-SalesforceAgentDataLibraryFile [-LibraryId] <String> [-FileId] <String> [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl file delete. This cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-FileId` (String, required): ID of the file to delete, from Get-SalesforceAgentDataLibraryFiles. Passed to sf as --file-id. Required.
- `-NoPrompt` (switch): 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.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl file delete`

#### Examples

```powershell
PS> Remove-SalesforceAgentDataLibraryFile -LibraryId 1JDxx0000000001 -FileId 0Pexx0000000001 -TargetOrg dev1 -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceAgentDataLibraryFile -Examples"
- For more information, type: "Get-Help Remove-SalesforceAgentDataLibraryFile -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceAgentDataLibraryFile -Full"
- For online help, type: "Get-Help Remove-SalesforceAgentDataLibraryFile -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Send-SalesforceAgentDataLibraryFile

#### Synopsis

Uploads files to an SFDRIVE data library.

#### Syntax

```powershell
Send-SalesforceAgentDataLibraryFile [-LibraryId] <String> [-File] <String[]> [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl upload, which uploads local files to a library whose source is sfdrive and can wait for them to be indexed. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-File` (String[], required): Files to upload. Each is passed to sf as its own --file. Each must exist. Passed to sf as --file. Required.
- `-WaitMinutes` (Int32): Number of minutes to wait for the upload and indexing. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl upload`

#### Examples

```powershell
PS> Send-SalesforceAgentDataLibraryFile -LibraryId 1JDxx0000000001 -File .\manual.pdf -WaitMinutes 10 -TargetOrg dev1
```

Upload a file and wait.

#### Remarks

- To see the examples, type: "Get-Help Send-SalesforceAgentDataLibraryFile -Examples"
- For more information, type: "Get-Help Send-SalesforceAgentDataLibraryFile -Detailed"
- For technical information, type: "Get-Help Send-SalesforceAgentDataLibraryFile -Full"
- For online help, type: "Get-Help Send-SalesforceAgentDataLibraryFile -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceAgentDataLibrary

#### Synopsis

Changes the settings of a data library.

#### Syntax

```powershell
Update-SalesforceAgentDataLibrary [-LibraryId] <String> [[-Name] <String>] [[-Description] <String>] [[-ContentFields] <String[]>] [[-RetrieverId] <String>] [-DataCategoryRule] [-RestrictToPublicArticles] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent adl update. Only the settings you give are changed. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-LibraryId` (String, required): ID of the data library. Passed to sf as --library-id. Required.
- `-Name` (String): New name (label). Passed to sf as --name.
- `-Description` (String): New description. Passed to sf as --description.
- `-ContentFields` (String[]): Knowledge fields to index. The values are joined with commas and passed as one --content-fields.
- `-RetrieverId` (String): ID of the retriever, for a retriever library. Passed to sf as --retriever-id.
- `-DataCategoryRule` (switch): Turn on the data category rule of a knowledge library. Adds --data-category-rule; -DataCategoryRule:$false sends --no-data-category-rule to turn it off.
- `-RestrictToPublicArticles` (switch): Index only public articles of a knowledge library. Adds --restrict-to-public-articles; -RestrictToPublicArticles:$false sends --no-restrict-to-public-articles to turn it off.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent adl update`

#### Examples

```powershell
PS> Update-SalesforceAgentDataLibrary -LibraryId 1JDxx0000000001 -Description 'Current manuals' -TargetOrg dev1 -WhatIf
```

Preview the change.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceAgentDataLibrary -Examples"
- For more information, type: "Get-Help Update-SalesforceAgentDataLibrary -Detailed"
- For technical information, type: "Get-Help Update-SalesforceAgentDataLibrary -Full"
- For online help, type: "Get-Help Update-SalesforceAgentDataLibrary -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Agent setup and authoring

### Disable-SalesforceAgent

#### Synopsis

Deactivates an Agentforce agent in an org.

#### Syntax

```powershell
Disable-SalesforceAgent [-ApiName] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent deactivate for the agent API name. The plugin @salesforce/plugin-agent must be installed; the cmdlet stops with install guidance if it is not. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-ApiName` (String, required): API name of the agent to deactivate; if not specified, the command provides a list that you choose from. Passed to sf as --api-name. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent deactivate`

#### Examples

```powershell
PS> Disable-SalesforceAgent -ApiName Service_Agent -TargetOrg dev1 -WhatIf
```

Show what would be deactivated.

#### Remarks

- To see the examples, type: "Get-Help Disable-SalesforceAgent -Examples"
- For more information, type: "Get-Help Disable-SalesforceAgent -Detailed"
- For technical information, type: "Get-Help Disable-SalesforceAgent -Full"
- For online help, type: "Get-Help Disable-SalesforceAgent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Enable-SalesforceAgent

#### Synopsis

Activates an Agentforce agent in an org.

#### Syntax

```powershell
Enable-SalesforceAgent [-ApiName] <String> [[-Version] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent activate for the agent API name and, optionally, a version. Activating makes the agent available to users. Needs the @salesforce/plugin-agent plugin. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-ApiName` (String, required): API name of the agent to activate; if not specified, the command provides a list that you choose from. Passed to sf as --api-name. Required.
- `-Version` (Int32): Version number of the agent to activate; if not specified, the command provides a list that you choose from. Passed to sf as --version. Range: 1 to 9999.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent activate`

#### Examples

```powershell
PS> Enable-SalesforceAgent -ApiName Service_Agent -Version 2 -TargetOrg dev1 -WhatIf
```

Preview activating version 2.

#### Remarks

- To see the examples, type: "Get-Help Enable-SalesforceAgent -Examples"
- For more information, type: "Get-Help Enable-SalesforceAgent -Detailed"
- For technical information, type: "Get-Help Enable-SalesforceAgent -Full"
- For online help, type: "Get-Help Enable-SalesforceAgent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgent

#### Synopsis

Creates an agent in an org from a local agent spec file.

#### Syntax

```powershell
New-SalesforceAgent [[-Spec] <String>] [[-Name] <String>] [[-ApiName] <String>] [-Preview] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent create. The agent spec is the YAML file made by New-SalesforceAgentSpecification. With -Preview the CLI shows what it would create without creating it. Supports -WhatIf and -Confirm; it does not prompt by default.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Spec` (String): Path of the agent spec YAML file. It must exist. Passed to sf as --spec.
- `-Name` (String): Name (label) of the agent. By default the CLI uses the name in the spec. Passed to sf as --name.
- `-ApiName` (String): API name of the new agent. By default the CLI derives it from the name. Passed to sf as --api-name.
- `-Preview` (switch): Show what would be created, without creating the agent. Adds --preview.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent create`

#### Examples

```powershell
PS> New-SalesforceAgent -Spec .\specs\service-agent.yaml -Name 'Service Agent' -TargetOrg dev1 -WhatIf
```

Preview the create.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgent -Examples"
- For more information, type: "Get-Help New-SalesforceAgent -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgent -Full"
- For online help, type: "Get-Help New-SalesforceAgent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentAuthoringBundle

#### Synopsis

Generates an authoring bundle (Agent Script) for an agent (sf agent generate authoring-bundle).

#### Syntax

```powershell
New-SalesforceAgentAuthoringBundle [-Name] <String> [[-ApiName] <String>] [[-Spec] <String>] [-NoSpec] [[-OutputDirectory] <String>] [-ForceOverwrite] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Writes files into the project, so it asks for confirmation and supports -WhatIf. The CLI requires -Name (the agent label) and either -Spec (an agent spec file made by the agent plugin) or -NoSpec to generate a blank bundle; both are checked before the CLI is called. -OutputDirectory is where the bundle goes (the CLI default is the project's authoring bundle folder). Returns the CLI result, which includes the paths written. Needs the @salesforce/plugin-agent plugin, a recent version, and Agentforce enabled in the org.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Name` (String, required): Name (label) of the authoring bundle; if not specified, you're prompted for the name. Passed to sf as --name. Required.
- `-ApiName` (String): API name of the new authoring bundle; if not specified, the API name is derived from the authoring bundle name (label); the API name can't exist in the org. Passed to sf as --api-name.
- `-Spec` (String): Path to the agent spec YAML file. If you don't specify the flag, the command provides a list that you can choose from. Use the --no-spec flag to skip using an agent spec entirely.
- `-NoSpec` (switch): Skip prompting for an agent spec and use the default Agent Script boilerplate in the generated authoring bundle. Adds --no-spec.
- `-OutputDirectory` (String): Directory where the authoring bundle files are generated. Passed to sf as --output-dir.
- `-ForceOverwrite` (switch): Overwrite an existing authoring bundle of that name without asking. Without it the CLI refuses to replace one. Adds --force-overwrite.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent generate authoring-bundle`

#### Examples

```powershell
PS> New-SalesforceAgentAuthoringBundle -Name 'Service Agent' -ApiName Service_Agent -Spec specs/agentSpec.yaml -TargetOrg my-org
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentAuthoringBundle -Examples"
- For more information, type: "Get-Help New-SalesforceAgentAuthoringBundle -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentAuthoringBundle -Full"
- For online help, type: "Get-Help New-SalesforceAgentAuthoringBundle -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentSpecification

#### Synopsis

Generates an agent spec: a YAML file that describes what an agent can do, with AI-suggested topics.

#### Syntax

```powershell
New-SalesforceAgentSpecification [[-Role] <String>] [[-CompanyName] <String>] [[-CompanyDescription] <String>] [[-CompanyWebsite] <String>] [[-Type] <String>] [[-Tone] <String>] [[-AgentUser] <String>] [[-MaxTopics] <Int32>] [[-GroundingContext] <String>] [[-PromptTemplate] <String>] [[-EnrichLogs] <String>] [[-Spec] <String>] [[-OutputFile] <String>] [-ForceOverwrite] [-FullInterview] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent generate agent-spec. The model of your org uses the role and company details to propose the agent's topics; edit the file afterwards, then create the agent with New-SalesforceAgent. Give the details as parameters and the cmdlet returns the CLI result. With -FullInterview the CLI asks for every property, so it is interactive: it needs a terminal, and you should run it as a plain command (an assigned or piped result hides the questions). To improve an existing spec, give it as -Spec.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Role` (String): The role of the agent in your company. Passed to sf as --role.
- `-CompanyName` (String): Name of your company. Passed to sf as --company-name.
- `-CompanyDescription` (String): Description of your company. Passed to sf as --company-description.
- `-CompanyWebsite` (String): Website of your company. Passed to sf as --company-website.
- `-Type` (String): Kind of agent. Valid values: customer, internal. Passed to sf as --type.
- `-Tone` (String): Tone of the agent. Valid values: formal, casual, neutral. Passed to sf as --tone.
- `-AgentUser` (String): User name of the agent user that the agent runs as. Passed to sf as --agent-user.
- `-MaxTopics` (Int32): Number of topics to propose. Passed to sf as --max-topics.
- `-GroundingContext` (String): Extra text that grounds the model, such as products or policies. Passed to sf as --grounding-context.
- `-PromptTemplate` (String): API name of the prompt template to use to generate the topics. Passed to sf as --prompt-template.
- `-EnrichLogs` (String): Whether to add the generated data to the agent logs. Valid values: true, false. Passed to sf as --enrich-logs.
- `-Spec` (String): An existing spec file to improve. It must exist. Passed to sf as --spec.
- `-OutputFile` (String): File to write the spec to. The CLI default is specs/agentSpec.yaml. The folder must exist. Passed to sf as --output-file.
- `-ForceOverwrite` (switch): Overwrite the output file without asking if it already exists. Adds --force-overwrite.
- `-FullInterview` (switch): Let the CLI ask for every property. Interactive: needs a terminal. Adds --full-interview.
- `-TargetOrg` (String): 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 agent generate agent-spec`

#### Examples

```powershell
PS> New-SalesforceAgentSpecification -Role 'Answers order questions' -CompanyName Acme -CompanyDescription 'We sell anvils' -Type customer -Tone casual -OutputFile .\specs\orders.yaml -TargetOrg dev1
```

Generate a spec without any questions.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentSpecification -Examples"
- For more information, type: "Get-Help New-SalesforceAgentSpecification -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentSpecification -Full"
- For online help, type: "Get-Help New-SalesforceAgentSpecification -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentTemplate

#### Synopsis

Generates an agent template from an agent in the project, to package in a managed package.

#### Syntax

```powershell
New-SalesforceAgentTemplate [-AgentFile] <String> [-AgentVersion] <Int32> [-SourceOrg] <String> [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent generate template. It reads the agent from the project and the org it came from, and writes a template that you can put in a second-generation managed package so others can install it. It writes local files and reads the source org.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-AgentFile` (String, required): Path of the agent's bot metadata file in the project. It must exist. Passed to sf as --agent-file. Required.
- `-AgentVersion` (Int32, required): Version of the agent to turn into a template. Passed to sf as --agent-version. Required.
- `-SourceOrg` (String, required): Username or alias of the org the agent was retrieved from. Passed to sf as --source-org. Required.
- `-OutputDirectory` (String): Folder to write the template to. The CLI default is the project's default package folder. Passed to sf as --output-dir.

#### Salesforce CLI

- `sf agent generate template`

#### Examples

```powershell
PS> New-SalesforceAgentTemplate -AgentFile force-app/main/default/bots/Service_Agent/Service_Agent.bot-meta.xml -AgentVersion 1 -SourceOrg dev1
```

Generate a template from version 1 of the agent.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentTemplate -Examples"
- For more information, type: "Get-Help New-SalesforceAgentTemplate -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentTemplate -Full"
- For online help, type: "Get-Help New-SalesforceAgentTemplate -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentUser

#### Synopsis

Creates the default user that an agent runs as.

#### Syntax

```powershell
New-SalesforceAgentUser [[-BaseUsername] <String>] [[-FirstName] <String>] [[-LastName] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org create agent-user, which creates the Einstein Agent user an agent uses to run its actions. Without the name parameters the CLI picks defaults. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-BaseUsername` (String): User name to base the new agent user's name on. The CLI adds a unique suffix. Passed to sf as --base-username.
- `-FirstName` (String): First name of the agent user. Passed to sf as --first-name.
- `-LastName` (String): Last name of the agent user. Passed to sf as --last-name.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org create agent-user`

#### Examples

```powershell
PS> New-SalesforceAgentUser -FirstName Service -LastName Agent -TargetOrg dev1 -WhatIf
```

Preview creating the agent user.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentUser -Examples"
- For more information, type: "Get-Help New-SalesforceAgentUser -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentUser -Full"
- For online help, type: "Get-Help New-SalesforceAgentUser -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Open-SalesforceAgent

#### Synopsis

Opens an agent in Agentforce Builder, or prints the link.

#### Syntax

```powershell
Open-SalesforceAgent [[-ApiName] <String>] [[-AuthoringBundle] <String>] [[-Version] <Int32>] [[-Browser] <String>] [-BrowserPrivateMode] [-UrlOnly] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf org open agent. The URL contains a session token, so treat it like a password; -UrlOnly prints it instead of opening a browser. Give -ApiName for a published agent or -AuthoringBundle for a local Agent Script agent.

#### Parameters

- `-ApiName` (String): API name of the agent to open. Use it or -AuthoringBundle, not both. Passed to sf as --api-name.
- `-AuthoringBundle` (String): API name of the authoring bundle to open. Use it or -ApiName, not both. Passed to sf as --authoring-bundle.
- `-Version` (Int32): Version of the agent to open. Passed to sf as --version.
- `-Browser` (String): Browser to open the agent in. Valid values: chrome, edge, firefox. Passed to sf as --browser.
- `-BrowserPrivateMode` (switch): Open the agent in the browser's private (incognito) mode. Adds --private.
- `-UrlOnly` (switch): Show the URL but do not open a browser. Adds --url-only.
- `-TargetOrg` (String): 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 org open agent`

#### Examples

```powershell
PS> Open-SalesforceAgent -ApiName Service_Agent -UrlOnly -TargetOrg dev1
```

Print the Builder link of a published agent.

#### Remarks

- To see the examples, type: "Get-Help Open-SalesforceAgent -Examples"
- For more information, type: "Get-Help Open-SalesforceAgent -Detailed"
- For technical information, type: "Get-Help Open-SalesforceAgent -Full"
- For online help, type: "Get-Help Open-SalesforceAgent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Publish-SalesforceAgentAuthoringBundle

#### Synopsis

Publishes an authoring bundle to the org as an agent (sf agent publish authoring-bundle).

#### Syntax

```powershell
Publish-SalesforceAgentAuthoringBundle [-ApiName] <String> [-SkipRetrieve] [-Concise] [-ExtendedDetails] [[-SourceType] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Changes the org, so it asks for confirmation and supports -WhatIf. Returns the CLI result (the published agent). By default the CLI retrieves the published agent metadata afterwards; -SkipRetrieve turns that off. Validate first with Test-SalesforceAgentAuthoringBundle.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-ApiName` (String, required): API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from. Passed to sf as --api-name. Required.
- `-SkipRetrieve` (switch): Don't retrieve the metadata associated with the agent to your DX project. Adds --skip-retrieve.
- `-Concise` (switch): Show a short summary of the publish instead of the full detail. Adds --concise.
- `-ExtendedDetails` (switch): Show more detail of the publish, such as each step. Adds --verbose. Cannot be used with -Concise.
- `-SourceType` (String): The kind of agent source that is published. Passed to sf as --source-type. Valid value: Bot, which is also the CLI default.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent publish authoring-bundle`

#### Examples

```powershell
PS> Publish-SalesforceAgentAuthoringBundle -ApiName Service_Agent -TargetOrg my-org
```

#### Remarks

- To see the examples, type: "Get-Help Publish-SalesforceAgentAuthoringBundle -Examples"
- For more information, type: "Get-Help Publish-SalesforceAgentAuthoringBundle -Detailed"
- For technical information, type: "Get-Help Publish-SalesforceAgentAuthoringBundle -Full"
- For online help, type: "Get-Help Publish-SalesforceAgentAuthoringBundle -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceAgentAuthoringBundle

#### Synopsis

Validates an authoring bundle and returns the diagnostics as objects (sf agent validate authoring-bundle).

#### Syntax

```powershell
Test-SalesforceAgentAuthoringBundle [-ApiName] <String> [-ThrowOnInvalid] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Read-only. Returns Valid, ApiName and Diagnostics (Message, Line, Column, Severity). Invalid Agent Script is returned as Valid = $false with its diagnostics, not thrown, so a script can print or filter them; add -ThrowOnInvalid to fail a CI step (error id PsfdxAgentValidationFailed, with the result as the target object). Failures that are not validation problems, such as an unknown org, always throw.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-ApiName` (String, required): API name of the authoring bundle you want to validate; if not specified, the command provides a list that you can choose from. Passed to sf as --api-name. Required.
- `-ThrowOnInvalid` (switch): Throw an error (id PsfdxAgentValidationFailed, with the result as its target object) when the bundle is not valid, instead of returning Valid = $false with its diagnostics. Meant for CI.
- `-TargetOrg` (String): 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 agent validate authoring-bundle`

#### Examples

```powershell
PS> $v = Test-SalesforceAgentAuthoringBundle -ApiName Service_Agent -TargetOrg my-org; $v.Diagnostics | Format-Table Line, Message
```

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceAgentAuthoringBundle -Examples"
- For more information, type: "Get-Help Test-SalesforceAgentAuthoringBundle -Detailed"
- For technical information, type: "Get-Help Test-SalesforceAgentAuthoringBundle -Full"
- For online help, type: "Get-Help Test-SalesforceAgentAuthoringBundle -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceAgentPlugin

#### Synopsis

Checks whether the Salesforce CLI agent plugin is installed.

#### Syntax

```powershell
Test-SalesforceAgentPlugin [<CommonParameters>]
```

#### Description

Runs sf plugins --core --json and returns $true when @salesforce/plugin-agent is listed, otherwise $false. The other agent cmdlets run this check first.

#### Salesforce CLI

- `sf plugins`

#### Examples

```powershell
PS> if (-not (Test-SalesforceAgentPlugin)) { Install-SalesforcePlugin -Name @salesforce/plugin-agent }
```

Install the plugin when it is missing.

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceAgentPlugin -Examples"
- For more information, type: "Get-Help Test-SalesforceAgentPlugin -Detailed"
- For technical information, type: "Get-Help Test-SalesforceAgentPlugin -Full"
- For online help, type: "Get-Help Test-SalesforceAgentPlugin -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Preview and traces

### Get-SalesforceAgentPreviewSessions

#### Synopsis

Lists the preview sessions that are still open.

#### Syntax

```powershell
Get-SalesforceAgentPreviewSessions [<CommonParameters>]
```

#### Description

Runs sf agent preview sessions and returns one object per known programmatic preview session (its ID and the agent). It reads local session records, so it needs no org.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Salesforce CLI

- `sf agent preview sessions`

#### Examples

```powershell
PS> Get-SalesforceAgentPreviewSessions
```

Every open session.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentPreviewSessions -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentPreviewSessions -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentPreviewSessions -Full"
- For online help, type: "Get-Help Get-SalesforceAgentPreviewSessions -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentTraces

#### Synopsis

Lists the trace files recorded during agent preview sessions.

#### Syntax

```powershell
Get-SalesforceAgentTraces [[-Agent] <String>] [[-SessionId] <String>] [[-Since] <DateTime>] [<CommonParameters>]
```

#### Description

Runs sf agent trace list. Trace files record how an agent handled each turn of a preview. It reads local files and needs no org.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Agent` (String): Only traces of the agent with this API name (a published agent or an authoring bundle). Passed to sf as --agent.
- `-SessionId` (String): Only traces of this preview session. Passed to sf as --session-id.
- `-Since` (DateTime): Only traces recorded on or after this date. It is sent as a date in the form yyyy-MM-dd. Passed to sf as --since.

#### Salesforce CLI

- `sf agent trace list`

#### Examples

```powershell
PS> Get-SalesforceAgentTraces -Agent Service_Agent -Since (Get-Date).AddDays(-7)
```

Last week's traces of an agent.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentTraces -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentTraces -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentTraces -Full"
- For online help, type: "Get-Help Get-SalesforceAgentTraces -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceAgentPreview

#### Synopsis

Talks to an agent in the terminal to see how it responds.

#### Syntax

```powershell
Invoke-SalesforceAgentPreview [[-ApiName] <String>] [[-AuthoringBundle] <String>] [[-ContextVariables] <IDictionary>] [[-ContextVariablesJson] <String>] [-ApexDebug] [-UseLiveActions] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent preview, the CLI version of the Preview panel in Agentforce Builder: you type utterances and read the answers. It is interactive, so it needs a terminal, and you should run it as a plain command (an assigned or piped result hides the conversation). Without -ApiName or -AuthoringBundle the CLI lets you pick an agent. For a conversation driven by a script use Start-SalesforceAgentPreview.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-ApiName` (String): API name of a published, activated agent. Use it or -AuthoringBundle, not both. Passed to sf as --api-name.
- `-AuthoringBundle` (String): API name of a local authoring bundle (an Agent Script agent in the project). Use it or -ApiName, not both. Passed to sf as --authoring-bundle.
- `-ContextVariables` (IDictionary): Context variables for the conversation as name and value pairs. Each pair is passed to sf as its own --context-variables name=value. Names are checked, and a value may not contain a double quote or line break. Cannot be used with -ContextVariablesJson. Passed to sf as --context-variables.
- `-ContextVariablesJson` (String): Context variables as a JSON string, for example '{"order":"1001"}'. It must be valid JSON. On Windows the CLI's .cmd launcher cannot take an argument with double quotes, which JSON always has, so this does not work there: use -ContextVariables. Cannot be used with -ContextVariables. Passed to sf as --context-variables-json.
- `-ApexDebug` (switch): Show Apex debug logs of the agent's actions. Adds --apex-debug.
- `-UseLiveActions` (switch): Run the real actions of the agent, which can change data. Only for an authoring bundle. Adds --use-live-actions.
- `-OutputDirectory` (String): Folder to save the conversation transcript and traces to. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 agent preview`

#### Examples

```powershell
PS> Invoke-SalesforceAgentPreview -ApiName Service_Agent -TargetOrg dev1
```

Chat with a published agent.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceAgentPreview -Examples"
- For more information, type: "Get-Help Invoke-SalesforceAgentPreview -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceAgentPreview -Full"
- For online help, type: "Get-Help Invoke-SalesforceAgentPreview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Read-SalesforceAgentTrace

#### Synopsis

Reads the trace of a preview session: what the agent did in each turn.

#### Syntax

```powershell
Read-SalesforceAgentTrace [-SessionId] <String> [[-Format] <String>] [[-Dimension] <String>] [[-Turn] <Int32>] [<CommonParameters>]
```

#### Description

Runs sf agent trace read. -Format picks how much you get: summary (the default), detail, or raw. With -Format detail, -Dimension narrows it to one kind of question. A turn is one utterance and response, counted from 1. It reads local files and needs no org.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-SessionId` (String, required): ID of the preview session to read. Passed to sf as --session-id. Required.
- `-Format` (String): How much to show. Valid values: summary, detail, raw. The CLI default is summary. Passed to sf as --format.
- `-Dimension` (String): What to look at with -Format detail. Valid values: actions, grounding, routing, errors. Passed to sf as --dimension.
- `-Turn` (Int32): Only this turn, counted from 1. Passed to sf as --turn.

#### Salesforce CLI

- `sf agent trace read`

#### Examples

```powershell
PS> Read-SalesforceAgentTrace -SessionId $session.sessionId -Format detail -Dimension routing
```

How the agent routed each turn.

#### Remarks

- To see the examples, type: "Get-Help Read-SalesforceAgentTrace -Examples"
- For more information, type: "Get-Help Read-SalesforceAgentTrace -Detailed"
- For technical information, type: "Get-Help Read-SalesforceAgentTrace -Full"
- For online help, type: "Get-Help Read-SalesforceAgentTrace -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceAgentTrace

#### Synopsis

Deletes trace files of preview sessions.

#### Syntax

```powershell
Remove-SalesforceAgentTrace [[-Agent] <String>] [[-SessionId] <String>] [[-OlderThan] <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent trace delete for the traces that match -Agent, -SessionId and -OlderThan. At least one filter is needed, so a call cannot delete every trace by accident. This cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time. It only touches local files.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Agent` (String): Only traces of the agent with this API name. Passed to sf as --agent.
- `-SessionId` (String): Only traces of this preview session. Passed to sf as --session-id.
- `-OlderThan` (String): Only traces older than this: a number and a unit, m (minutes), h (hours), d (days) or w (weeks), for example 7d or 24h. Passed to sf as --older-than.
- `-NoPrompt` (switch): Do not ask for confirmation. Skips the PowerShell question; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent trace delete`

#### Examples

```powershell
PS> Remove-SalesforceAgentTrace -Agent Service_Agent -OlderThan 30d -WhatIf
```

Preview deleting a month-old traces.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceAgentTrace -Examples"
- For more information, type: "Get-Help Remove-SalesforceAgentTrace -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceAgentTrace -Full"
- For online help, type: "Get-Help Remove-SalesforceAgentTrace -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Send-SalesforceAgentPreviewMessage

#### Synopsis

Sends a message to a preview session and returns the agent's answer.

#### Syntax

```powershell
Send-SalesforceAgentPreviewMessage [-Utterance] <String> [[-SessionId] <String>] [[-ApiName] <String>] [[-AuthoringBundle] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent preview send. This is a programmatic preview session: each step is its own command, so a script or another tool can drive the conversation. Give the session with -SessionId, or the agent with -ApiName or -AuthoringBundle if there is only one open session for it. The message is passed as one argument, so special characters need no escaping. On Windows the CLI's .cmd launcher cannot take a double quote or a line break in an argument, so leave those out there.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-Utterance` (String, required): What to say to the agent. Passed to sf as --utterance. Required.
- `-SessionId` (String): ID of the preview session, from Start-SalesforceAgentPreview. Passed to sf as --session-id.
- `-ApiName` (String): API name of a published, activated agent. Use it or -AuthoringBundle, not both. Passed to sf as --api-name.
- `-AuthoringBundle` (String): API name of a local authoring bundle (an Agent Script agent in the project). Use it or -ApiName, not both. Passed to sf as --authoring-bundle.
- `-TargetOrg` (String): 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 agent preview send`

#### Examples

```powershell
PS> Send-SalesforceAgentPreviewMessage -SessionId $session.sessionId -Utterance 'Where is my order?' -TargetOrg dev1
```

Ask the agent a question.

#### Remarks

- To see the examples, type: "Get-Help Send-SalesforceAgentPreviewMessage -Examples"
- For more information, type: "Get-Help Send-SalesforceAgentPreviewMessage -Detailed"
- For technical information, type: "Get-Help Send-SalesforceAgentPreviewMessage -Full"
- For online help, type: "Get-Help Send-SalesforceAgentPreviewMessage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceAgentPreview

#### Synopsis

Starts a programmatic preview session with an agent.

#### Syntax

```powershell
Start-SalesforceAgentPreview [[-ApiName] <String>] [[-AuthoringBundle] <String>] [[-ContextVariables] <IDictionary>] [[-ContextVariablesJson] <String>] [-SimulateActions] [-UseLiveActions] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent preview start and returns the session, with the session ID that Send-SalesforceAgentPreviewMessage, Stop-SalesforceAgentPreview and Get-SalesforceAgentTrace* use. This is a programmatic preview session: each step is its own command, so a script or another tool can drive the conversation. Give -ApiName for a published agent or -AuthoringBundle for a local Agent Script agent. For a conversation you type yourself use Invoke-SalesforceAgentPreview.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-ApiName` (String): API name of a published, activated agent. Use it or -AuthoringBundle, not both. Passed to sf as --api-name.
- `-AuthoringBundle` (String): API name of a local authoring bundle (an Agent Script agent in the project). Use it or -ApiName, not both. Passed to sf as --authoring-bundle.
- `-ContextVariables` (IDictionary): Context variables for the conversation as name and value pairs. Each pair is passed to sf as its own --context-variables name=value. Names are checked, and a value may not contain a double quote or line break. Cannot be used with -ContextVariablesJson. Passed to sf as --context-variables.
- `-ContextVariablesJson` (String): Context variables as a JSON string, for example '{"order":"1001"}'. It must be valid JSON. On Windows the CLI's .cmd launcher cannot take an argument with double quotes, which JSON always has, so this does not work there: use -ContextVariables. Cannot be used with -ContextVariables. Passed to sf as --context-variables-json.
- `-SimulateActions` (switch): Simulate the agent's actions instead of running them. Only for an authoring bundle. Adds --simulate-actions.
- `-UseLiveActions` (switch): Run the real actions of the agent, which can change data. Only for an authoring bundle. Adds --use-live-actions.
- `-TargetOrg` (String): 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 agent preview start`

#### Examples

```powershell
PS> $session = Start-SalesforceAgentPreview -ApiName Service_Agent -TargetOrg dev1
```

Start a session with a published agent.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceAgentPreview -Examples"
- For more information, type: "Get-Help Start-SalesforceAgentPreview -Detailed"
- For technical information, type: "Get-Help Start-SalesforceAgentPreview -Full"
- For online help, type: "Get-Help Start-SalesforceAgentPreview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Stop-SalesforceAgentPreview

#### Synopsis

Ends a preview session and returns where its trace files are.

#### Syntax

```powershell
Stop-SalesforceAgentPreview [[-SessionId] <String>] [-All] [[-ApiName] <String>] [[-AuthoringBundle] <String>] [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent preview end. Give the session with -SessionId, the agent with -ApiName or -AuthoringBundle, or -All to end every session. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

Run it inside a Salesforce DX project (a folder with sfdx-project.json, or below one): the CLI refuses this command anywhere else.

#### Parameters

- `-SessionId` (String): ID of the preview session to end. Passed to sf as --session-id.
- `-All` (switch): End every preview session. Adds --all.
- `-ApiName` (String): API name of a published, activated agent. Use it or -AuthoringBundle, not both. Passed to sf as --api-name.
- `-AuthoringBundle` (String): API name of a local authoring bundle (an Agent Script agent in the project). Use it or -ApiName, not both. Passed to sf as --authoring-bundle.
- `-NoPrompt` (switch): Do not ask for confirmation. Skips the PowerShell question; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent preview end`

#### Examples

```powershell
PS> Stop-SalesforceAgentPreview -SessionId $session.sessionId -TargetOrg dev1 -Confirm:$false
```

End one session without a question.

#### Remarks

- To see the examples, type: "Get-Help Stop-SalesforceAgentPreview -Examples"
- For more information, type: "Get-Help Stop-SalesforceAgentPreview -Detailed"
- For technical information, type: "Get-Help Stop-SalesforceAgentPreview -Full"
- For online help, type: "Get-Help Stop-SalesforceAgentPreview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Tests and evaluations

### Get-SalesforceAgentTestResult

#### Synopsis

Gets the results of an Agentforce agent test run.

#### Syntax

```powershell
Get-SalesforceAgentTestResult [-JobId] <String> [-ExtendedDetails] [[-OutputDirectory] <String>] [[-ResultFormat] <String>] [[-TestRunner] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent test results for a job ID returned by Start-SalesforceAgentTest. Needs the @salesforce/plugin-agent plugin.

#### Parameters

- `-JobId` (String, required): Job ID of the completed agent test run. Passed to sf as --job-id. Required.
- `-ExtendedDetails` (switch): Show the generated data, such as the full response of each test, in the results. Adds --verbose.
- `-OutputDirectory` (String): Folder to write the results files to. Passed to sf as --output-dir.
- `-ResultFormat` (String): Format of the results. Passed to sf as --result-format. Valid values: json, human, junit, tap. Without it the cmdlet returns the result as an object, as before. With json it does too; with human, junit or tap the CLI text is returned as it is.
- `-TestRunner` (String): The test runner that holds the test. Passed to sf as --test-runner. Valid values: agentforce-studio, testing-center.
- `-TargetOrg` (String): 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 agent test results`

#### Examples

```powershell
PS> Get-SalesforceAgentTestResult -JobId 4KBxx0000000001 -TargetOrg dev1
```

Results of that run.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentTestResult -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentTestResult -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentTestResult -Full"
- For online help, type: "Get-Help Get-SalesforceAgentTestResult -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceAgentTests

#### Synopsis

Lists the agent tests available in an org.

#### Syntax

```powershell
Get-SalesforceAgentTests [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent test list and returns the test definitions as objects (an empty array when there are none). Needs the @salesforce/plugin-agent plugin.

#### Parameters

- `-TargetOrg` (String): 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 agent test list`

#### Examples

```powershell
PS> Get-SalesforceAgentTests -TargetOrg dev1
```

Agent tests in the org.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceAgentTests -Examples"
- For more information, type: "Get-Help Get-SalesforceAgentTests -Detailed"
- For technical information, type: "Get-Help Get-SalesforceAgentTests -Full"
- For online help, type: "Get-Help Get-SalesforceAgentTests -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentTest

#### Synopsis

Creates an agent test in an org from a local test spec file.

#### Syntax

```powershell
New-SalesforceAgentTest [[-Spec] <String>] [[-ApiName] <String>] [-Preview] [-ForceOverwrite] [[-TestRunner] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent test create. The spec is the YAML file made by New-SalesforceAgentTestSpecification. With -Preview the CLI shows what it would create without creating it. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-Spec` (String): Path of the test spec YAML file. It must exist. Passed to sf as --spec.
- `-ApiName` (String): API name of the new test. By default the CLI derives it from the spec. Passed to sf as --api-name.
- `-Preview` (switch): Show what would be created, without creating the test. Adds --preview.
- `-ForceOverwrite` (switch): Replace the test without asking if one with that API name already exists. Adds --force-overwrite.
- `-TestRunner` (String): The test runner that holds or runs the test. Valid values: agentforce-studio, testing-center. Passed to sf as --test-runner.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent test create`

#### Examples

```powershell
PS> New-SalesforceAgentTest -Spec .\specs\orders-testSpec.yaml -ApiName Orders_Test -TargetOrg dev1 -WhatIf
```

Preview the create.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentTest -Examples"
- For more information, type: "Get-Help New-SalesforceAgentTest -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentTest -Full"
- For online help, type: "Get-Help New-SalesforceAgentTest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceAgentTestSpecification

#### Synopsis

Generates an agent test spec: a YAML file that lists the test cases of an agent.

#### Syntax

```powershell
New-SalesforceAgentTestSpecification [[-FromDefinition] <String>] [[-OutputFile] <String>] [-ForceOverwrite] [[-TestRunner] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent generate test-spec, the first step of making an agent test. By default the CLI asks questions (the agent, then the utterances, expected topic, actions and outcome of each test case), so it is interactive: it needs a terminal, and you should run it as a plain command (an assigned or piped result hides the questions). With -FromDefinition it converts an existing test definition file instead and asks nothing. It reads the project and writes a local file; it never looks in your org. Create the test in the org with New-SalesforceAgentTest.

#### Parameters

- `-FromDefinition` (String): Path of an existing test definition file to convert into a spec, instead of answering questions. It must exist. Passed to sf as --from-definition.
- `-OutputFile` (String): File to write the spec to. The CLI default is specs/&lt;agent&gt;-testSpec.yaml. The folder must exist. Passed to sf as --output-file.
- `-ForceOverwrite` (switch): Overwrite the output file without asking if it already exists. Adds --force-overwrite.
- `-TestRunner` (String): The test runner that holds or runs the test. Valid values: agentforce-studio, testing-center. Passed to sf as --test-runner.

#### Salesforce CLI

- `sf agent generate test-spec`

#### Examples

```powershell
PS> New-SalesforceAgentTestSpecification -OutputFile .\specs\orders-testSpec.yaml
```

Answer the questions to build a spec.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAgentTestSpecification -Examples"
- For more information, type: "Get-Help New-SalesforceAgentTestSpecification -Detailed"
- For technical information, type: "Get-Help New-SalesforceAgentTestSpecification -Full"
- For online help, type: "Get-Help New-SalesforceAgentTestSpecification -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforceAgentTest

#### Synopsis

Waits for an agent test run you started earlier and returns its results.

#### Syntax

```powershell
Resume-SalesforceAgentTest -JobId <String> [-WaitMinutes <Int32>] [-ExtendedDetails] [-OutputDirectory <String>] [-ResultFormat <String>] [-TestRunner <String>] [-TargetOrg <String>] [<CommonParameters>]
Resume-SalesforceAgentTest -UseMostRecent [-WaitMinutes <Int32>] [-ExtendedDetails] [-OutputDirectory <String>] [-ResultFormat <String>] [-TestRunner <String>] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Runs sf agent test resume for the job ID that Start-SalesforceAgentTest returned, or for the most recent run with -UseMostRecent. With -ResultFormat json (the default) the results come back as an object; the other formats return the CLI text. It does not change anything in the org.

#### Parameters

- `-JobId` (String, required): ID of the test run (the job ID). Required unless you give -UseMostRecent. Passed to sf as --job-id. Required.
- `-UseMostRecent` (switch, required): Resume the most recent test run instead of giving -JobId. Adds --use-most-recent. Required.
- `-WaitMinutes` (Int32): Number of minutes to wait for the run to finish. Passed to sf as --wait.
- `-ExtendedDetails` (switch): Show the generated data, such as the full response of each test, in the results. Adds --verbose.
- `-OutputDirectory` (String): Folder to write the results files to. Passed to sf as --output-dir.
- `-ResultFormat` (String): Format of the results. Valid values: json, human, junit, tap. With json the result is returned as an object; with the others the CLI text is returned as it is. Passed to sf as --result-format.
- `-TestRunner` (String): The test runner that holds or runs the test. Valid values: agentforce-studio, testing-center. Passed to sf as --test-runner.
- `-TargetOrg` (String): 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 agent test resume`

#### Examples

```powershell
PS> Resume-SalesforceAgentTest -UseMostRecent -WaitMinutes 10 -TargetOrg dev1
```

Wait for the latest run.

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforceAgentTest -Examples"
- For more information, type: "Get-Help Resume-SalesforceAgentTest -Detailed"
- For technical information, type: "Get-Help Resume-SalesforceAgentTest -Full"
- For online help, type: "Get-Help Resume-SalesforceAgentTest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceAgentEvaluation

#### Synopsis

Runs rich evaluation tests against an agent. Beta.

#### Syntax

```powershell
Start-SalesforceAgentEvaluation [-Spec] <String> [[-ApiName] <String>] [[-BatchSize] <Int32>] [-NoNormalize] [[-ResultFormat] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent test run-eval, which runs the test cases of a spec file (YAML or JSON) against an agent, without a test being created in the org. This CLI command is in beta, so its flags and output can change in a later release. With -ResultFormat json the results come back as an object; the CLI default, human, and the other formats return text.

#### Parameters

- `-Spec` (String, required): Path of the test spec file (YAML or JSON). It must exist. Passed to sf as --spec. Required.
- `-ApiName` (String): API name of the agent to test. By default the CLI reads it from the spec's subjectName. Passed to sf as --api-name.
- `-BatchSize` (Int32): Number of tests to send per request. The CLI default is 5 and the maximum is 5. Passed to sf as --batch-size.
- `-NoNormalize` (switch): Do not normalize field names and shorthand references in the spec. Adds --no-normalize.
- `-ResultFormat` (String): Format of the results. Valid values: json, human, junit, tap. With json the result is returned as an object; with the others the CLI text is returned as it is. Passed to sf as --result-format.
- `-TargetOrg` (String): 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 agent test run-eval`

#### Examples

```powershell
PS> Start-SalesforceAgentEvaluation -Spec .\specs\orders-eval.yaml -ResultFormat json -TargetOrg dev1
```

Run an evaluation and get the results as an object.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceAgentEvaluation -Examples"
- For more information, type: "Get-Help Start-SalesforceAgentEvaluation -Detailed"
- For technical information, type: "Get-Help Start-SalesforceAgentEvaluation -Full"
- For online help, type: "Get-Help Start-SalesforceAgentEvaluation -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceAgentTest

#### Synopsis

Starts an Agentforce agent test and optionally waits for it.

#### Syntax

```powershell
Start-SalesforceAgentTest [-ApiName] <String> [[-WaitMinutes] <Int32>] [-ExtendedDetails] [[-OutputDirectory] <String>] [[-ResultFormat] <String>] [[-TestRunner] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent test run for the test API name. Without -WaitMinutes the run is started and the job ID is returned; fetch the outcome later with Get-SalesforceAgentTestResult. Needs the @salesforce/plugin-agent plugin.

#### Parameters

- `-ApiName` (String, required): API name of the agent test to run; corresponds to the name of the AiEvaluationDefinition metadata component that implements the agent test. Passed to sf as --api-name. Required.
- `-WaitMinutes` (Int32): Number of minutes to wait for the command to complete and display results to the terminal window. Passed to sf as --wait. Range: 1 to 1440.
- `-ExtendedDetails` (switch): Show the generated data, such as the full response of each test, in the results. Adds --verbose.
- `-OutputDirectory` (String): Folder to write the results files to. Passed to sf as --output-dir.
- `-ResultFormat` (String): Format of the results. Passed to sf as --result-format. Valid values: json, human, junit, tap. Without it the cmdlet returns the result as an object, as before. With json it does too; with human, junit or tap the CLI text is returned as it is.
- `-TestRunner` (String): The test runner that holds the test. Passed to sf as --test-runner. Valid values: agentforce-studio, testing-center.
- `-TargetOrg` (String): 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 agent test run`

#### Examples

```powershell
PS> Start-SalesforceAgentTest -ApiName Service_Agent_Test -WaitMinutes 10 -TargetOrg dev1
```

Run the test and wait up to ten minutes.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceAgentTest -Examples"
- For more information, type: "Get-Help Start-SalesforceAgentTest -Detailed"
- For technical information, type: "Get-Help Start-SalesforceAgentTest -Full"
- For online help, type: "Get-Help Start-SalesforceAgentTest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## MCP servers and assets

### Get-SalesforceMcpAssets

#### Synopsis

Lists the assets (tools, prompts and resources) of an MCP server in the catalog. Preview.

#### Syntax

```powershell
Get-SalesforceMcpAssets [-McpServerId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent mcp asset list and returns one object per asset that is allowed in the catalog. Use Get-SalesforceMcpServerLiveAssets for what the server offers right now. This CLI command is a preview, so its flags and output can change in a later release. It only reads.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-TargetOrg` (String): 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 agent mcp asset list`

#### Examples

```powershell
PS> Get-SalesforceMcpAssets -McpServerId 0Xxxx0000000001 -TargetOrg dev1
```

The allowed assets of a server.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceMcpAssets -Examples"
- For more information, type: "Get-Help Get-SalesforceMcpAssets -Detailed"
- For technical information, type: "Get-Help Get-SalesforceMcpAssets -Full"
- For online help, type: "Get-Help Get-SalesforceMcpAssets -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceMcpServer

#### Synopsis

Shows one MCP server of the API Catalog. Preview.

#### Syntax

```powershell
Get-SalesforceMcpServer [-McpServerId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent mcp get. This CLI command is a preview, so its flags and output can change in a later release. It only reads.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-TargetOrg` (String): 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 agent mcp get`

#### Examples

```powershell
PS> Get-SalesforceMcpServer -McpServerId 0Xxxx0000000001 -TargetOrg dev1
```

The details of one server.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceMcpServer -Examples"
- For more information, type: "Get-Help Get-SalesforceMcpServer -Detailed"
- For technical information, type: "Get-Help Get-SalesforceMcpServer -Full"
- For online help, type: "Get-Help Get-SalesforceMcpServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceMcpServerLiveAssets

#### Synopsis

Asks an MCP server for the assets it offers right now. Preview.

#### Syntax

```powershell
Get-SalesforceMcpServerLiveAssets [-McpServerId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent mcp fetch, which connects to the server and returns one object per tool, prompt or resource it advertises. It works only for an external MCP server; the CLI refuses a standard (platform) one. Compare it with Get-SalesforceMcpAssets, then change the allowed set with Set-SalesforceMcpAssets. This CLI command is a preview, so its flags and output can change in a later release. It does not change the catalog.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-TargetOrg` (String): 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 agent mcp fetch`

#### Examples

```powershell
PS> Get-SalesforceMcpServerLiveAssets -McpServerId 0Xxxx0000000001 -TargetOrg dev1
```

What the server offers now.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceMcpServerLiveAssets -Examples"
- For more information, type: "Get-Help Get-SalesforceMcpServerLiveAssets -Detailed"
- For technical information, type: "Get-Help Get-SalesforceMcpServerLiveAssets -Full"
- For online help, type: "Get-Help Get-SalesforceMcpServerLiveAssets -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceMcpServers

#### Synopsis

Lists the MCP servers of the API Catalog. Preview.

#### Syntax

```powershell
Get-SalesforceMcpServers [[-Label] <String>] [[-Status] <String>] [[-Type] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf agent mcp list and returns one object per server. This CLI command is a preview, so its flags and output can change in a later release. It only reads.

#### Parameters

- `-Label` (String): Only servers with this label. Passed to sf as --label.
- `-Status` (String): Only servers with this status. Valid values: ACTIVE, DISCONNECTED. Passed to sf as --status.
- `-Type` (String): Only servers of this type. Valid value: EXTERNAL. Passed to sf as --type.
- `-TargetOrg` (String): 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 agent mcp list`

#### Examples

```powershell
PS> Get-SalesforceMcpServers -Status ACTIVE -TargetOrg dev1
```

The servers that are connected.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceMcpServers -Examples"
- For more information, type: "Get-Help Get-SalesforceMcpServers -Detailed"
- For technical information, type: "Get-Help Get-SalesforceMcpServers -Full"
- For online help, type: "Get-Help Get-SalesforceMcpServers -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceMcpServer

#### Synopsis

Registers an MCP server in the API Catalog. Preview.

#### Syntax

```powershell
New-SalesforceMcpServer [-Name] <String> [-ServerUrl] <String> [[-AuthType] <String>] [[-Label] <String>] [[-Description] <String>] [[-IdentityProvider] <String>] [[-Scope] <String>] [[-ClientId] <String>] [[-ClientSecret] <SecureString>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent mcp create, which adds a Model Context Protocol server to the org's API Catalog so agents can use its tools. This CLI command is a preview, so its flags and output can change in a later release. The server URL must be an absolute https URL, because credentials are sent to it. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-Name` (String, required): Unique name of the server. Passed to sf as --name. Required.
- `-ServerUrl` (String, required): URL of the MCP server. It must be an absolute https:// URL. Passed to sf as --server-url. Required.
- `-AuthType` (String): How the server is authenticated. Valid values: OAUTH, NO_AUTH. Passed to sf as --auth-type.
- `-Label` (String): Label shown for the server. Passed to sf as --label.
- `-Description` (String): Description of the server. Passed to sf as --description.
- `-IdentityProvider` (String): Name of the identity provider, for OAUTH. Passed to sf as --identity-provider.
- `-Scope` (String): OAuth scope, for OAUTH. Passed to sf as --scope.
- `-ClientId` (String): OAuth client ID, for OAUTH. Passed to sf as --client-id.
- `-ClientSecret` (SecureString): OAuth client secret of the server, as a SecureString, for example (Read-Host -AsSecureString). It is turned into text only when the command is built, and the CLI's own verbose line hides it. Passed to sf as --client-secret.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent mcp create`

#### Examples

```powershell
PS> New-SalesforceMcpServer -Name Orders_Mcp -ServerUrl https://mcp.example.com/orders -AuthType OAUTH -ClientId $id -ClientSecret (Read-Host -AsSecureString) -TargetOrg dev1 -WhatIf
```

Preview registering a server.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceMcpServer -Examples"
- For more information, type: "Get-Help New-SalesforceMcpServer -Detailed"
- For technical information, type: "Get-Help New-SalesforceMcpServer -Full"
- For online help, type: "Get-Help New-SalesforceMcpServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceMcpServer

#### Synopsis

Deletes an MCP server from the API Catalog. Preview.

#### Syntax

```powershell
Remove-SalesforceMcpServer [-McpServerId] <String> [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent mcp delete. Agents that use the server lose its tools, and this cannot be undone. This CLI command is a preview, so its flags and output can change in a later release. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-NoPrompt` (switch): Do not ask for confirmation. Skips the PowerShell question; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent mcp delete`

#### Examples

```powershell
PS> Remove-SalesforceMcpServer -McpServerId 0Xxxx0000000001 -TargetOrg dev1 -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceMcpServer -Examples"
- For more information, type: "Get-Help Remove-SalesforceMcpServer -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceMcpServer -Full"
- For online help, type: "Get-Help Remove-SalesforceMcpServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Set-SalesforceMcpAssets

#### Synopsis

Replaces the allowed assets of an MCP server in the catalog. Preview.

#### Syntax

```powershell
Set-SalesforceMcpAssets [-McpServerId] <String> [[-Assets] <String>] [[-AssetList] <Object>] [[-AssetsFile] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent mcp asset replace. The set you give replaces the allowed set, so an asset that is not in it is no longer allowed. Give the set as a JSON string in -Assets, as an object or array in -AssetList (psfdx converts it to JSON), or as a JSON file in -AssetsFile. This CLI command is a preview, so its flags and output can change in a later release. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-Assets` (String): The allowed assets as a JSON string. It must be valid JSON. On Windows the CLI's .cmd launcher cannot take an argument with double quotes, which JSON always has, so this does not work there: use -AssetsFile. Use one of -Assets, -AssetList and -AssetsFile. Passed to sf as --assets.
- `-AssetList` (Object): The allowed assets as a PowerShell object or array, sent as JSON. On Windows the CLI's .cmd launcher cannot take an argument with double quotes, which JSON always has, so this does not work there: use -AssetsFile. Use one of -Assets, -AssetList and -AssetsFile. Sent to sf as --assets.
- `-AssetsFile` (String): Path of a JSON file with the allowed assets. It must exist. Use one of -Assets, -AssetList and -AssetsFile. Passed to sf as --assets-file.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent mcp asset replace`

#### Examples

```powershell
PS> Set-SalesforceMcpAssets -McpServerId 0Xxxx0000000001 -AssetsFile .\assets.json -TargetOrg dev1 -WhatIf
```

Preview replacing the set.

#### Remarks

- To see the examples, type: "Get-Help Set-SalesforceMcpAssets -Examples"
- For more information, type: "Get-Help Set-SalesforceMcpAssets -Detailed"
- For technical information, type: "Get-Help Set-SalesforceMcpAssets -Full"
- For online help, type: "Get-Help Set-SalesforceMcpAssets -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceMcpServer

#### Synopsis

Changes an MCP server in the API Catalog. Preview.

#### Syntax

```powershell
Update-SalesforceMcpServer [-McpServerId] <String> [[-ServerUrl] <String>] [[-AuthType] <String>] [[-Label] <String>] [[-Description] <String>] [[-IdentityProvider] <String>] [[-Scope] <String>] [[-ClientId] <String>] [[-ClientSecret] <SecureString>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf agent mcp update. Only the settings you give are changed. This CLI command is a preview, so its flags and output can change in a later release. A new server URL must be an absolute https URL. Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-McpServerId` (String, required): ID of the MCP server in the API Catalog. Passed to sf as --mcp-server-id. Required.
- `-ServerUrl` (String): New URL of the server. It must be an absolute https:// URL. Passed to sf as --server-url.
- `-AuthType` (String): How the server is authenticated. Valid values: OAUTH, NO_AUTH. Passed to sf as --auth-type.
- `-Label` (String): New label. Passed to sf as --label.
- `-Description` (String): New description. Passed to sf as --description.
- `-IdentityProvider` (String): New identity provider name. Passed to sf as --identity-provider.
- `-Scope` (String): New OAuth scope. Passed to sf as --scope.
- `-ClientId` (String): New OAuth client ID. Passed to sf as --client-id.
- `-ClientSecret` (SecureString): OAuth client secret of the server, as a SecureString, for example (Read-Host -AsSecureString). It is turned into text only when the command is built, and the CLI's own verbose line hides it. Passed to sf as --client-secret.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf agent mcp update`

#### Examples

```powershell
PS> Update-SalesforceMcpServer -McpServerId 0Xxxx0000000001 -Description 'Orders tools' -TargetOrg dev1 -WhatIf
```

Preview the change.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceMcpServer -Examples"
- For more information, type: "Get-Help Update-SalesforceMcpServer -Detailed"
- For technical information, type: "Get-Help Update-SalesforceMcpServer -Full"
- For online help, type: "Get-Help Update-SalesforceMcpServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-agent>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-data command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-data/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

20 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Bulk API 2.0**: [Export-SalesforceBulkData](#export-salesforcebulkdata), [Get-SalesforceBulkJobStatus](#get-salesforcebulkjobstatus), [Get-SalesforceBulkResult](#get-salesforcebulkresult), [Import-SalesforceBulkData](#import-salesforcebulkdata), [Remove-SalesforceBulkData](#remove-salesforcebulkdata), [Resume-SalesforceBulkJob](#resume-salesforcebulkjob), [Update-SalesforceBulkData](#update-salesforcebulkdata), [Upsert-SalesforceBulkData](#upsert-salesforcebulkdata)

**Tree data**: [Export-SalesforceTreeData](#export-salesforcetreedata), [Import-SalesforceTreeData](#import-salesforcetreedata)

**Records and queries**: [Get-SalesforceObjectRecordCount](#get-salesforceobjectrecordcount), [Get-SalesforceRecord](#get-salesforcerecord), [Get-SalesforceRecordType](#get-salesforcerecordtype), [New-SalesforceFile](#new-salesforcefile), [New-SalesforceRecord](#new-salesforcerecord), [Remove-SalesforceRecord](#remove-salesforcerecord), [Search-SalesforceRecords](#search-salesforcerecords), [Select-SalesforceRecords](#select-salesforcerecords), [Set-SalesforceRecord](#set-salesforcerecord), [Upsert-SalesforceRecord](#upsert-salesforcerecord)

## Bulk API 2.0

### Export-SalesforceBulkData

#### Synopsis

Exports the records of a SOQL query to a file with Bulk API 2.0 (sf data export bulk).

#### Syntax

```powershell
Export-SalesforceBulkData [-OutputFile] <String> [[-Query] <String>] [[-QueryFile] <String>] [[-ResultFormat] <String>] [-AllRows] [[-ColumnDelimiter] <String>] [[-LineEnding] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Give the query as -Query or -QueryFile (a file avoids line breaks, which the Windows CLI shim rejects as an argument). The query is passed to the CLI unchanged. Without -WaitMinutes the job is created and its JobId returned; finish it later with Resume-SalesforceBulkJob -Operation Export. With -WaitMinutes the cmdlet waits and returns TotalSize.

#### Parameters

- `-OutputFile` (String, required): File where records are written. Passed to sf as --output-file. Required.
- `-Query` (String): SOQL query to execute. Passed to sf as --query.
- `-QueryFile` (String): File that contains the SOQL query. Passed to sf as --query-file.
- `-ResultFormat` (String): Format to write the results. Passed to sf as --result-format. Default: csv. Valid values: csv, json.
- `-AllRows` (switch): Include records that have been soft-deleted due to a merge or delete. By default, deleted records are not returned. Adds --all-rows.
- `-ColumnDelimiter` (String): Column delimiter to be used when writing CSV output. Default is COMMA. Passed to sf as --column-delimiter. Valid values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB.
- `-LineEnding` (String): Line ending to be used when writing CSV output. Default value on Windows is is `CRLF`; on macOS and Linux it's `LR`. Passed to sf as --line-ending. Valid values: LF, CRLF.
- `-WaitMinutes` (Int32): Time to wait for the command to finish, in minutes. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): 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 data export bulk`

#### Examples

```powershell
PS> Export-SalesforceBulkData -Query 'SELECT Id, Name FROM Account' -OutputFile .\accounts.csv -WaitMinutes 10 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Export-SalesforceBulkData -Examples"
- For more information, type: "Get-Help Export-SalesforceBulkData -Detailed"
- For technical information, type: "Get-Help Export-SalesforceBulkData -Full"
- For online help, type: "Get-Help Export-SalesforceBulkData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceBulkJobStatus

#### Synopsis

Shows the status of a bulk data load job, or of one batch in it (sf data resume).

#### Syntax

```powershell
Get-SalesforceBulkJobStatus [-JobId] <String> [[-BatchId] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf data resume, which reads the state of a bulk job from the org and returns it as an object. It only reads: it does not continue or change the job. For a Bulk API 2.0 job started with -WaitMinutes 0, use Resume-SalesforceBulkJob to continue it and Get-SalesforceBulkResult for its row results.

#### Parameters

- `-JobId` (String, required): ID of the bulk job. Passed to sf as --job-id. Required.
- `-BatchId` (String): ID of one batch in the job. Passed to sf as --batch-id.
- `-TargetOrg` (String): 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 data resume`

#### Examples

```powershell
PS> Get-SalesforceBulkJobStatus -JobId 750xx0000000001AAA -TargetOrg myorg
```

The state of the job.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceBulkJobStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceBulkJobStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceBulkJobStatus -Full"
- For online help, type: "Get-Help Get-SalesforceBulkJobStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceBulkResult

#### Synopsis

Gets the outcome of a Bulk API 2.0 ingest job and saves its row results as CSV files (sf data bulk results).

#### Syntax

```powershell
Get-SalesforceBulkResult [-JobId] <String> [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

The CLI writes &lt;JobId&gt;-success-records.csv, &lt;JobId&gt;-failed-records.csv and &lt;JobId&gt;-unprocessed-records.csv into its working directory, so the cmdlet runs it in -OutputDirectory (the current directory by default) and returns the full paths of the files it wrote. Records that failed do not make this cmdlet throw: check HasFailures or FailedRecords. A job that has not finished is an error. Works for any job in the org, including ones this computer did not create.

#### Parameters

- `-JobId` (String, required): Job ID of the bulk job. Passed to sf as --job-id. Required.
- `-OutputDirectory` (String): Folder the result files are written to. It is created if it does not exist. Defaults to the current folder. The cmdlet runs the CLI there and returns the full paths of the files it wrote.
- `-TargetOrg` (String): 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 data bulk results`

#### Examples

```powershell
PS> $r = Get-SalesforceBulkResult -JobId 750xx0000000001 -OutputDirectory .\bulk -TargetOrg myorg; if ($r.HasFailures) { Import-Csv $r.FailedFilePath }
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceBulkResult -Examples"
- For more information, type: "Get-Help Get-SalesforceBulkResult -Detailed"
- For technical information, type: "Get-Help Get-SalesforceBulkResult -Full"
- For online help, type: "Get-Help Get-SalesforceBulkResult -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Import-SalesforceBulkData

#### Synopsis

Inserts the rows of a CSV file with Bulk API 2.0 (sf data import bulk).

#### Syntax

```powershell
Import-SalesforceBulkData [-File] <String> [-Object] <String> [[-ColumnDelimiter] <String>] [[-LineEnding] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Creates records. Asks for confirmation only when $ConfirmPreference is Medium or lower, and -WhatIf makes no CLI call. Without -WaitMinutes the job is created and its JobId returned; with it the cmdlet waits and returns the counts. A job with failed rows throws PsfdxBulkJobFailed (see Get-SalesforceBulkResult for the row results).

#### Parameters

- `-File` (String, required): CSV file that contains the Salesforce object records you want to import. Passed to sf as --file. Required.
- `-Object` (String, required): API name of the Salesforce object, either standard or custom, into which you're importing records. Passed to sf as --sobject. Required.
- `-ColumnDelimiter` (String): Column delimiter used in the CSV file. Passed to sf as --column-delimiter. Valid values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB.
- `-LineEnding` (String): Line ending used in the CSV file. Default value on Windows is `CRLF`; on macOS and Linux it's `LF`. Passed to sf as --line-ending. Valid values: LF, CRLF.
- `-WaitMinutes` (Int32): Time to wait for the command to finish, in minutes. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data import bulk`

#### Examples

```powershell
PS> Import-SalesforceBulkData -File '.\new accounts.csv' -Object Account -WaitMinutes 10 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Import-SalesforceBulkData -Examples"
- For more information, type: "Get-Help Import-SalesforceBulkData -Detailed"
- For technical information, type: "Get-Help Import-SalesforceBulkData -Full"
- For online help, type: "Get-Help Import-SalesforceBulkData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceBulkData

#### Synopsis

Deletes the records whose IDs are in a CSV file with Bulk API 2.0 (sf data delete bulk).

#### Syntax

```powershell
Remove-SalesforceBulkData [-File] <String> [-Object] <String> [-HardDelete] [[-LineEnding] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

The CSV needs an Id column. By default the records go to the Recycle Bin; -HardDelete deletes them permanently, which cannot be undone, and needs the Bulk API Hard Delete permission. Asks for confirmation by default, naming the object, the file, the org and whether the delete is permanent; -WhatIf makes no CLI call. Scripts that run unattended need -Confirm:$false. Without -WaitMinutes the job is created and its JobId returned; finish it with Resume-SalesforceBulkJob -Operation Delete. With -WaitMinutes the cmdlet waits and returns the counts. A job with failed rows throws PsfdxBulkJobFailed (see Get-SalesforceBulkResult for the row results).

#### Parameters

- `-File` (String, required): CSV file that contains the IDs of the records to delete. Passed to sf as --file. Required.
- `-Object` (String, required): API name of the Salesforce object, either standard or custom, that you want to delete records from. Passed to sf as --sobject. Required.
- `-HardDelete` (switch): Delete the records permanently, without moving them to the Recycle Bin. Adds --hard-delete. The user needs the Bulk API Hard Delete permission.
- `-LineEnding` (String): Line ending used in the CSV file. Default value on Windows is `CRLF`; on macOS and Linux it's `LF`. Passed to sf as --line-ending. Valid values: LF, CRLF.
- `-WaitMinutes` (Int32): Time to wait for the command to finish, in minutes. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data delete bulk`

#### Examples

```powershell
PS> Remove-SalesforceBulkData -File .\old-accounts.csv -Object Account -WaitMinutes 10 -TargetOrg myorg -WhatIf
```

Preview the delete without sending anything.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceBulkData -Examples"
- For more information, type: "Get-Help Remove-SalesforceBulkData -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceBulkData -Full"
- For online help, type: "Get-Help Remove-SalesforceBulkData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforceBulkJob

#### Synopsis

Resumes a Bulk API 2.0 job started without -WaitMinutes (sf data export|import|update|upsert|delete resume).

#### Syntax

```powershell
Resume-SalesforceBulkJob -Operation <String> -JobId <String> [-WaitMinutes <Int32>] [-TargetOrg <String>] [<CommonParameters>]
Resume-SalesforceBulkJob -Operation <String> -UseMostRecent [-WaitMinutes <Int32>] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Pass the JobId from the earlier step and the -Operation that created it, or -UseMostRecent for the job the CLI started last. The CLI remembers jobs it created on this computer, so import, update and export resumes find the org from that record; they do not take -TargetOrg (it is ignored with a warning), and a job created elsewhere cannot be resumed here: use Get-SalesforceBulkResult with -TargetOrg instead. Upsert and Delete resumes do take -TargetOrg. Export resumes do not take -WaitMinutes. Resuming only continues the existing job, so it does not ask for confirmation. Errors are as for the cmdlet that created the job.

#### Parameters

- `-Operation` (String, required): The kind of bulk job to resume: Export, Import, Update, Upsert or Delete. It selects which command runs: sf data export, import, update, upsert or delete resume. Required. Valid values: Export, Import, Update, Upsert, Delete.
- `-JobId` (String, required): Job ID of the bulk job. Passed to sf as --job-id. Required unless you give -UseMostRecent.
- `-UseMostRecent` (switch, required): Resume the job that was started most recently, instead of giving -JobId. Adds --use-most-recent.
- `-WaitMinutes` (Int32): Time to wait for the command to finish, in minutes. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): 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 data export resume`
- `sf data import resume`
- `sf data update resume`
- `sf data upsert resume`
- `sf data delete resume`

#### Examples

```powershell
PS> Resume-SalesforceBulkJob -Operation Upsert -JobId 750xx0000000001 -WaitMinutes 10 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforceBulkJob -Examples"
- For more information, type: "Get-Help Resume-SalesforceBulkJob -Detailed"
- For technical information, type: "Get-Help Resume-SalesforceBulkJob -Full"
- For online help, type: "Get-Help Resume-SalesforceBulkJob -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceBulkData

#### Synopsis

Updates records from the rows of a CSV file with Bulk API 2.0 (sf data update bulk).

#### Syntax

```powershell
Update-SalesforceBulkData [-File] <String> [-Object] <String> [[-ColumnDelimiter] <String>] [[-LineEnding] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

The CSV needs an Id column. Asks for confirmation only when $ConfirmPreference is Medium or lower, and -WhatIf makes no CLI call. Results are as for Import-SalesforceBulkData.

#### Parameters

- `-File` (String, required): CSV file that contains the Salesforce object records you want to update. Passed to sf as --file. Required.
- `-Object` (String, required): API name of the Salesforce object, either standard or custom, which you are updating. Passed to sf as --sobject. Required.
- `-ColumnDelimiter` (String): Column delimiter used in the CSV file. Passed to sf as --column-delimiter. Valid values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB.
- `-LineEnding` (String): Line ending used in the CSV file. Default value on Windows is `CRLF`; on macOS and Linux it's `LF`. Passed to sf as --line-ending. Valid values: LF, CRLF.
- `-WaitMinutes` (Int32): Time to wait for the command to finish, in minutes. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data update bulk`

#### Examples

```powershell
PS> Update-SalesforceBulkData -File .\changes.csv -Object Contact -WaitMinutes 10 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceBulkData -Examples"
- For more information, type: "Get-Help Update-SalesforceBulkData -Detailed"
- For technical information, type: "Get-Help Update-SalesforceBulkData -Full"
- For online help, type: "Get-Help Update-SalesforceBulkData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Upsert-SalesforceBulkData

#### Synopsis

Inserts or updates records from the rows of a CSV file by external ID with Bulk API 2.0 (sf data upsert bulk).

#### Syntax

```powershell
Upsert-SalesforceBulkData [-File] <String> [-Object] <String> [-ExternalIdField] <String> [[-ColumnDelimiter] <String>] [[-LineEnding] <String>] [[-WaitMinutes] <Int32>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

-ExternalIdField names the external ID field the CSV matches on, and its column must be in the file. Asks for confirmation only when $ConfirmPreference is Medium or lower, and -WhatIf makes no CLI call. For one record use Upsert-SalesforceRecord.

#### Parameters

- `-File` (String, required): CSV file that contains the IDs of the records to update or delete. Passed to sf as --file. Required.
- `-Object` (String, required): API name of the Salesforce object, either standard or custom, that you want to update or delete records from. Passed to sf as --sobject. Required.
- `-ExternalIdField` (String, required): Name of the external ID field, or the Id field. Passed to sf as --external-id. Required.
- `-ColumnDelimiter` (String): Column delimiter used in the CSV file. Passed to sf as --column-delimiter. Valid values: BACKQUOTE, CARET, COMMA, PIPE, SEMICOLON, TAB.
- `-LineEnding` (String): Line ending used in the CSV file. Default value on Windows is `CRLF`; on macOS and Linux it's `LF`. Passed to sf as --line-ending. Valid values: LF, CRLF.
- `-WaitMinutes` (Int32): Number of minutes to wait for the command to complete before displaying the results. Passed to sf as --wait. Default: 0. Range: 0 to 1440.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data upsert bulk`

#### Examples

```powershell
PS> Upsert-SalesforceBulkData -File .\accounts.csv -Object Account -ExternalIdField Ext_Id__c -WaitMinutes 10 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Upsert-SalesforceBulkData -Examples"
- For more information, type: "Get-Help Upsert-SalesforceBulkData -Detailed"
- For technical information, type: "Get-Help Upsert-SalesforceBulkData -Full"
- For online help, type: "Get-Help Upsert-SalesforceBulkData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Tree data

### Export-SalesforceTreeData

#### Synopsis

Exports records, with their related child records, to JSON files for Import-SalesforceTreeData (sf data export tree).

#### Syntax

```powershell
Export-SalesforceTreeData [-Query] <String[]> [-Plan] [[-Prefix] <String>] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Each -Query is a SOQL query; a query with a subquery exports parent and children together. The queries go to the CLI unchanged, so use one line and no double quotes (the Windows CLI shim rejects line breaks and double quotes in an argument). Without -Plan the records are returned in Records and the CLI writes one JSON file per query. With -Plan the CLI writes one file per object and a plan file that references them, which Import-SalesforceTreeData -Plan reads; Files and PlanFile hold their paths. The CLI creates -OutputDirectory if it does not exist.

#### Parameters

- `-Query` (String[], required): One or more SOQL queries whose records, with the related records they select, are exported. Each query is passed as its own --query. A query with a parent-to-child subquery exports the children too. Required.
- `-Plan` (switch): Generate multiple sObject tree files and a plan definition file for aggregated import. Adds --plan.
- `-Prefix` (String): Prefix of generated files. Passed to sf as --prefix.
- `-OutputDirectory` (String): Directory in which to generate the JSON files; default is current directory. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 data export tree`

#### Examples

```powershell
PS> Export-SalesforceTreeData -Query "SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account WHERE Name LIKE 'Acme%'" -Plan -OutputDirectory .\data -TargetOrg source
PS> Import-SalesforceTreeData -Plan .\data\Account-Contact-plan.json -TargetOrg scratch
```

#### Remarks

- To see the examples, type: "Get-Help Export-SalesforceTreeData -Examples"
- For more information, type: "Get-Help Export-SalesforceTreeData -Detailed"
- For technical information, type: "Get-Help Export-SalesforceTreeData -Full"
- For online help, type: "Get-Help Export-SalesforceTreeData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Import-SalesforceTreeData

#### Synopsis

Imports records and their related child records from JSON files into an org (sf data import tree).

#### Syntax

```powershell
Import-SalesforceTreeData -Plan <String> [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Import-SalesforceTreeData -File <String[]> [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Give either -Plan (a plan file from Export-SalesforceTreeData -Plan) or -File (one or more tree JSON files), not both. Asks for confirmation only when $ConfirmPreference is Medium or lower, and -WhatIf makes no CLI call. Returns one object per record created: RefId, Type and Id. If Salesforce rejects records, nothing is returned and the cmdlet throws PsfdxTreeImportFailed, whose TargetObject lists each failed reference with its StatusCode, Message and Fields. The Tree API imports at most 200 records per call.

#### Parameters

- `-Plan` (String, required): Plan definition file to insert multiple data files. Passed to sf as --plan. Required in the Plan parameter set.
- `-File` (String[], required): Comma-separated and in-order JSON files that contain the records, in sObject tree format, that you want to insert. Passed to sf as --files. Required in the Files parameter set.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data import tree`

#### Examples

```powershell
PS> Import-SalesforceTreeData -Plan .\data\Account-Contact-plan.json -TargetOrg scratch
```

#### Remarks

- To see the examples, type: "Get-Help Import-SalesforceTreeData -Examples"
- For more information, type: "Get-Help Import-SalesforceTreeData -Detailed"
- For technical information, type: "Get-Help Import-SalesforceTreeData -Full"
- For online help, type: "Get-Help Import-SalesforceTreeData -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Records and queries

### Get-SalesforceObjectRecordCount

#### Synopsis

Shows how many records objects have in an org.

#### Syntax

```powershell
Get-SalesforceObjectRecordCount [[-SObject] <String[]>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Returns approximate counts from the org's stored totals, which can differ from the results of a SOQL COUNT() query. By default it includes every standard and custom object that supports this operation. Use -SObject to request counts for specific objects.

#### Parameters

- `-SObject` (String[]): API names of the objects to count, for example Account, Contact or Invoice__c. Each name is passed as its own --sobject. Names may contain only letters, digits and underscores.
- `-TargetOrg` (String): 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 org list sobject record-counts`

#### Examples

```powershell
PS> Get-SalesforceObjectRecordCount -SObject Account, Contact -TargetOrg dev1
```

Record counts of Account and Contact.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceObjectRecordCount -Examples"
- For more information, type: "Get-Help Get-SalesforceObjectRecordCount -Detailed"
- For technical information, type: "Get-Help Get-SalesforceObjectRecordCount -Full"
- For online help, type: "Get-Help Get-SalesforceObjectRecordCount -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-limits>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceRecord

#### Synopsis

Gets one record, by ID or by field values (sf data get record).

#### Syntax

```powershell
Get-SalesforceRecord -Type <String> -Id <String> [-UseToolingApi] [-TargetOrg <String>] [<CommonParameters>]
Get-SalesforceRecord -Type <String> -Where <IDictionary> [-UseToolingApi] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Select the record with -Id, or with -Where, a hashtable of field values that identify exactly one record (the CLI reports an error for none or for several). They are alternatives: the CLI accepts only one. The record is returned as an object of its fields, without the internal attributes property. A value in -Where is passed to the CLI as Field='value'; because the CLI has no way to escape a quote inside a value, a value that contains a single quote, a double quote or a line break is refused. For anything more complex use Select-SalesforceRecords. A record that does not exist makes the cmdlet throw the CLI's message.

#### Parameters

- `-Type` (String, required): API name of the Salesforce or Tooling API object that you're retrieving a record from. Passed to sf as --sobject. Required.
- `-Id` (String, required): ID of the record you're retrieving. Passed to sf as --record-id. Required in the ById parameter set. Alias: RecordId. Accepts input from the pipeline by property name.
- `-Where` (IDictionary, required): List of &lt;fieldName&gt;=&lt;value&gt; pairs that identify the record you want to display. Passed to sf as --where. Required in the ByFields parameter set.
- `-UseToolingApi` (switch): Use Tooling API so you can retrieve a record from a Tooling API object. Adds --use-tooling-api.
- `-TargetOrg` (String): 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 data get record`

#### Examples

```powershell
PS> Get-SalesforceRecord -Type Account -Id 001xx000003DGb2AAG -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceRecord -Examples"
- For more information, type: "Get-Help Get-SalesforceRecord -Detailed"
- For technical information, type: "Get-Help Get-SalesforceRecord -Full"
- For online help, type: "Get-Help Get-SalesforceRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceRecordType

#### Synopsis

Lists record types, optionally for one object.

#### Syntax

```powershell
Get-SalesforceRecordType [-ObjectType] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Queries the RecordType object (Id, SobjectType, Name, DeveloperName, IsActive) through Select-SalesforceRecords. The object name is escaped as a SOQL literal.

#### Parameters

- `-ObjectType` (String, required): API name of the object whose record types you want, for example Account. Without it, record types of every object are returned. Required.
- `-TargetOrg` (String): Username or alias of the org to query. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceRecordType -ObjectType Account -TargetOrg dev1
```

Record types of Account.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceRecordType -Examples"
- For more information, type: "Get-Help Get-SalesforceRecordType -Detailed"
- For technical information, type: "Get-Help Get-SalesforceRecordType -Full"
- For online help, type: "Get-Help Get-SalesforceRecordType -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceFile

#### Synopsis

Uploads a local file to an org as a Salesforce File.

#### Syntax

```powershell
New-SalesforceFile [-File] <String> [[-ParentId] <String>] [[-Title] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf data create file. The file becomes a ContentVersion, so it shows under Files in the org. Give -ParentId to attach it to a record, for example an account. Supports -WhatIf and -Confirm; it does not prompt by default. The file is read by the CLI; psfdx only checks that it exists.

#### Parameters

- `-File` (String, required): Path of the local file to upload. Passed to sf as --file. It must exist. Required.
- `-ParentId` (String): ID of the record to attach the file to (a 15 or 18 character ID). Passed to sf as --parent-id.
- `-Title` (String): Title of the file in Salesforce. By default the CLI uses the file name. Passed to sf as --title.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data create file`

#### Examples

```powershell
PS> New-SalesforceFile -File '.\Q4 report.pdf' -ParentId 001xx000003DGb2AAG -Title 'Q4 report' -TargetOrg myorg
```

Upload the PDF and attach it to the account.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceFile -Examples"
- For more information, type: "Get-Help New-SalesforceFile -Detailed"
- For technical information, type: "Get-Help New-SalesforceFile -Full"
- For online help, type: "Get-Help New-SalesforceFile -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceRecord

#### Synopsis

Creates one record (sf data create record).

#### Syntax

```powershell
New-SalesforceRecord [-Type] <String> [-FieldUpdates] <String> [[-TargetOrg] <String>] [-UseToolingApi] [-SkipAssignmentRules] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

-FieldUpdates is the CLI's values string, for example "Name='Acme' Industry='Energy'". Supports -WhatIf and -Confirm; it does not prompt by default.

#### Parameters

- `-Type` (String, required): API name of the Salesforce or Tooling API object that you're inserting a record into. Passed to sf as --sobject. Required.
- `-FieldUpdates` (String, required): Values for the flags in the form &lt;fieldName&gt;=&lt;value&gt;, separate multiple pairs with spaces. Passed to sf as --values. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-UseToolingApi` (switch): Use Tooling API so you can insert a record in a Tooling API object. Adds --use-tooling-api.
- `-SkipAssignmentRules` (switch): Do not run the assignment rules when the record is created. This matters for a Case or Lead, which are assigned by rule otherwise. Adds --skip-assignment-rules.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data create record`

#### Examples

```powershell
PS> New-SalesforceRecord -Type Account -FieldUpdates "Name='Acme'" -WhatIf
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceRecord -Examples"
- For more information, type: "Get-Help New-SalesforceRecord -Detailed"
- For technical information, type: "Get-Help New-SalesforceRecord -Full"
- For online help, type: "Get-Help New-SalesforceRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceRecord

#### Synopsis

Deletes one record, by ID or by field values (sf data delete record).

#### Syntax

```powershell
Remove-SalesforceRecord -Type <String> -Id <String> [-UseToolingApi] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-SalesforceRecord -Type <String> -Where <IDictionary> [-UseToolingApi] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Select the record as for Get-SalesforceRecord: -Id, or -Where (field values that identify exactly one record). Asks for confirmation by default, naming the object, the record and the org; -WhatIf makes no CLI call. Returns the CLI's result (the deleted record's Id). A record that does not exist, or a -Where that matches several, makes the cmdlet throw the CLI's message, so nothing is hidden. Scripts that run unattended need -Confirm:$false.

#### Parameters

- `-Type` (String, required): API name of the Salesforce or Tooling API object that you're deleting a record from. Passed to sf as --sobject. Required.
- `-Id` (String, required): ID of the record you're deleting. Passed to sf as --record-id. Required in the ById parameter set. Alias: RecordId. Accepts input from the pipeline by property name.
- `-Where` (IDictionary, required): List of &lt;fieldName&gt;=&lt;value&gt; pairs that identify the record you want to delete. Passed to sf as --where. Required in the ByFields parameter set.
- `-UseToolingApi` (switch): Use Tooling API so you can delete a record from a Tooling API object. Adds --use-tooling-api.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data delete record`

#### Examples

```powershell
PS> Remove-SalesforceRecord -Type Account -Id 001xx000003DGb2AAG -TargetOrg myorg -WhatIf
```

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceRecord -Examples"
- For more information, type: "Get-Help Remove-SalesforceRecord -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceRecord -Full"
- For online help, type: "Get-Help Remove-SalesforceRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Search-SalesforceRecords

#### Synopsis

Runs a SOSL text search and returns the matching records as objects.

#### Syntax

```powershell
Search-SalesforceRecords -Query <String> [-ResultFormat <String>] [-TargetOrg <String>] [<CommonParameters>]
Search-SalesforceRecords -File <String> [-ResultFormat <String>] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Runs sf data search with --query or --file. SOSL searches the text fields of several objects at once, for example FIND {Acme} IN ALL FIELDS RETURNING Account(Id, Name), Contact(Id, Name). With the default -ResultFormat json the records are returned as objects without their attributes property, each with an SObject property that holds the object it came from; no match returns nothing (wrap the call in @() for an empty array). With human or csv the CLI text is returned as it is. A bad search throws the CLI message. The query is passed as one argument, so braces and quotes need no escaping; on Windows the CLI shim rejects a double quote or a line break in an argument, so put such a query in a file and use -File.

#### Parameters

- `-Query` (String, required): SOSL query to execute. Passed to sf as --query. Give -Query or -File.
- `-File` (String, required): File that contains the SOSL query. Passed to sf as --file. It must exist. Give -Query or -File.
- `-ResultFormat` (String): Format to display the results. Default: json. Valid values: human, csv, json. Passed to sf as --result-format for human and csv; json is read through --json.
- `-TargetOrg` (String): 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 data search`

#### Examples

```powershell
PS> Search-SalesforceRecords -Query 'FIND {Acme} IN NAME FIELDS RETURNING Account(Id, Name), Contact(Id, Name)' -TargetOrg dev1
```

Accounts and contacts whose name matches Acme.

#### Remarks

- To see the examples, type: "Get-Help Search-SalesforceRecords -Examples"
- For more information, type: "Get-Help Search-SalesforceRecords -Detailed"
- For technical information, type: "Get-Help Search-SalesforceRecords -Full"
- For online help, type: "Get-Help Search-SalesforceRecords -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Select-SalesforceRecords

#### Synopsis

Runs a SOQL query and returns the records as objects.

#### Syntax

```powershell
Select-SalesforceRecords [[-Query] <String>] [[-File] <String>] [[-TargetOrg] <String>] [-UseToolingApi] [-IncludeDeletedRows] [[-ResultFormat] <String>] [[-OutputFile] <String>] [<CommonParameters>]
```

#### Description

Runs sf data query with --query or --file. With the default -ResultFormat json the records are returned as objects without their attributes property; an empty result returns nothing (wrap the call in @() for an empty array). With human or csv the CLI text is returned as it is. A failing query throws the CLI message. The query text is passed as one argument, so quotes and special characters need no escaping.

#### Parameters

- `-Query` (String): SOQL query to execute. Passed to sf as --query.
- `-File` (String): File that contains the SOQL query. Passed to sf as --file.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-UseToolingApi` (switch): Use Tooling API so you can run queries on Tooling API objects. Adds --use-tooling-api.
- `-IncludeDeletedRows` (switch): Include deleted records. By default, deleted records are not returned. Adds --all-rows.
- `-ResultFormat` (String): Format to display the results; the --json flag overrides this flag. Default: json. Valid values: human, json, csv.
- `-OutputFile` (String): File where records are written; only CSV and JSON output formats are supported. Passed to sf as --output-file.

#### Salesforce CLI

- `sf data query`

#### Examples

```powershell
PS> Select-SalesforceRecords -Query 'SELECT Id, Name FROM Account LIMIT 5' -TargetOrg dev1
```

Five accounts as objects.

#### Remarks

- To see the examples, type: "Get-Help Select-SalesforceRecords -Examples"
- For more information, type: "Get-Help Select-SalesforceRecords -Detailed"
- For technical information, type: "Get-Help Select-SalesforceRecords -Full"
- For online help, type: "Get-Help Select-SalesforceRecords -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Set-SalesforceRecord

#### Synopsis

Updates one record by ID (sf data update record).

#### Syntax

```powershell
Set-SalesforceRecord -Id <String> -Type <String> -FieldUpdates <String> [-TargetOrg <String>] [-UseToolingApi] [-SkipAssignmentRules] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-SalesforceRecord -Where <IDictionary> -Type <String> -FieldUpdates <String> [-TargetOrg <String>] [-UseToolingApi] [-SkipAssignmentRules] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Select the record by -Id (which can come from the pipeline, as an Id or RecordId property), or by -Where, field values that identify exactly one record, as for Get-SalesforceRecord. -FieldUpdates is the CLI's values string, for example "Name='Acme' Active__c=true". Supports -WhatIf and -Confirm; it does not prompt by default. A -Where that matches no record, or several, makes the cmdlet throw the CLI's message.

#### Parameters

- `-Id` (String, required): ID of the record you're updating. Passed to sf as --record-id. Required in the ById parameter set. Alias: RecordId. Accepts input from the pipeline by property name.
- `-Where` (IDictionary, required): List of &lt;fieldName&gt;=&lt;value&gt; pairs that identify the record you want to update, for example @{ Name = 'Acme' }. Passed to sf as --where. Required in the ByFields parameter set. Values may not contain quotes or control characters.
- `-Type` (String, required): API name of the Salesforce or Tooling API object that contains the record you're updating. Passed to sf as --sobject. Required.
- `-FieldUpdates` (String, required): Fields that you're updating, in the format of &lt;fieldName&gt;=&lt;value&gt; pairs. Passed to sf as --values. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-UseToolingApi` (switch): Use Tooling API so you can update a record in a Tooling API object. Adds --use-tooling-api.
- `-SkipAssignmentRules` (switch): Do not run the assignment rules when the record is updated. This matters for a Case or Lead. Adds --skip-assignment-rules.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf data update record`

#### Examples

```powershell
PS> Select-SalesforceRecords -Query "SELECT Id FROM Account WHERE Name = 'Old'" | Set-SalesforceRecord -Type Account -FieldUpdates "Name='New'" -WhatIf
```

#### Remarks

- To see the examples, type: "Get-Help Set-SalesforceRecord -Examples"
- For more information, type: "Get-Help Set-SalesforceRecord -Detailed"
- For technical information, type: "Get-Help Set-SalesforceRecord -Full"
- For online help, type: "Get-Help Set-SalesforceRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Upsert-SalesforceRecord

#### Synopsis

Creates or updates one record, matched by an external ID.

#### Syntax

```powershell
Upsert-SalesforceRecord [-Type] <String> [-ExternalIdField] <String> [-ExternalId] <String> [-Fields] <IDictionary> [[-ApiVersion] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Matches an existing record by its external ID and updates it, or creates a record if no match exists. The result reports Created or Updated and includes the record Id when the API returns it.

#### Parameters

- `-Type` (String, required): API name of the object, for example Account. Required.
- `-ExternalIdField` (String, required): API name of the external ID field used to find the record. Required.
- `-ExternalId` (String, required): Value of the external ID. It is URL-escaped in the request path. Required.
- `-Fields` (IDictionary, required): Hashtable of field API names and values to set, for example @{ Name = 'Acme' }. It must not be empty. Required.
- `-ApiVersion` (String): REST API version to use, for example v62.0 or 62.0. If omitted, the latest version the org supports is used.
- `-TargetOrg` (String): 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 api request rest`

#### Examples

```powershell
PS> Upsert-SalesforceRecord -Type Account -ExternalIdField Ext_Id__c -ExternalId A-100 -Fields @{ Name = 'Acme' } -TargetOrg dev1
```

Create or update the account whose Ext_Id__c is A-100.

#### Remarks

- To see the examples, type: "Get-Help Upsert-SalesforceRecord -Examples"
- For more information, type: "Get-Help Upsert-SalesforceRecord -Detailed"
- For technical information, type: "Get-Help Upsert-SalesforceRecord -Full"
- For online help, type: "Get-Help Upsert-SalesforceRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-api>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-development command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-development/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

58 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Jest tests**: [Debug-SalesforceJest](#debug-salesforcejest), [Install-SalesforceJest](#install-salesforcejest), [New-SalesforceJestTest](#new-salesforcejesttest), [Test-SalesforceJest](#test-salesforcejest), [Watch-SalesforceJest](#watch-salesforcejest)

**Project configuration**: [Disable-SalesforceSourceTracking](#disable-salesforcesourcetracking), [Enable-SalesforceSourceTracking](#enable-salesforcesourcetracking), [Get-SalesforceConfiguration](#get-salesforceconfiguration), [Get-SalesforceTargetDevHub](#get-salesforcetargetdevhub), [Get-SalesforceTargetOrg](#get-salesforcetargetorg), [New-SalesforceProject](#new-salesforceproject), [Remove-SalesforceTargetDevHub](#remove-salesforcetargetdevhub), [Remove-SalesforceTargetOrg](#remove-salesforcetargetorg), [Set-SalesforceTargetDevHub](#set-salesforcetargetdevhub), [Set-SalesforceTargetOrg](#set-salesforcetargetorg)

**Apex**: [Get-SalesforceApexClass](#get-salesforceapexclass), [Get-SalesforceApexCompileStatus](#get-salesforceapexcompilestatus), [Get-SalesforceApexTestResult](#get-salesforceapextestresult), [Get-SalesforceCodeCoverage](#get-salesforcecodecoverage), [Invoke-SalesforceApex](#invoke-salesforceapex), [New-SalesforceApexClass](#new-salesforceapexclass), [New-SalesforceApexTrigger](#new-salesforceapextrigger), [Start-SalesforceApexTest](#start-salesforceapextest), [Test-SalesforceApex](#test-salesforceapex), [Wait-SalesforceApexTest](#wait-salesforceapextest), [Watch-SalesforceApex](#watch-salesforceapex)

**Code Analyzer**: [Get-SalesforceCodeAnalyzerConfiguration](#get-salesforcecodeanalyzerconfiguration), [Get-SalesforceCodeAnalyzerRule](#get-salesforcecodeanalyzerrule), [Get-SalesforceCodeAnalyzerSyntaxTree](#get-salesforcecodeanalyzersyntaxtree), [Invoke-SalesforceCodeAnalyzer](#invoke-salesforcecodeanalyzer)

**Flow and logic tests**: [Get-SalesforceFlowTestResult](#get-salesforceflowtestresult), [Get-SalesforceLogicTestResult](#get-salesforcelogictestresult), [Test-SalesforceFlow](#test-salesforceflow), [Test-SalesforceLogic](#test-salesforcelogic)

**Org shapes and snapshots**: [Get-SalesforceOrgShapes](#get-salesforceorgshapes), [Get-SalesforceOrgSnapshot](#get-salesforceorgsnapshot), [Get-SalesforceOrgSnapshots](#get-salesforceorgsnapshots), [New-SalesforceOrgShape](#new-salesforceorgshape), [New-SalesforceOrgSnapshot](#new-salesforceorgsnapshot), [Remove-SalesforceOrgShape](#remove-salesforceorgshape), [Remove-SalesforceOrgSnapshot](#remove-salesforceorgsnapshot)

**Local development servers**: [Install-SalesforceLwcDevServer](#install-salesforcelwcdevserver), [Start-SalesforceLwcDevServer](#start-salesforcelwcdevserver), [Start-SalesforceUiBundleDevServer](#start-salesforceuibundledevserver)

**Component and template generation**: [New-SalesforceAnalyticsTemplate](#new-salesforceanalyticstemplate), [New-SalesforceExperienceSite](#new-salesforceexperiencesite), [New-SalesforceFlexiPage](#new-salesforceflexipage), [New-SalesforceLightningApp](#new-salesforcelightningapp), [New-SalesforceLightningComponent](#new-salesforcelightningcomponent), [New-SalesforceLightningEvent](#new-salesforcelightningevent), [New-SalesforceLightningInterface](#new-salesforcelightninginterface), [New-SalesforceLightningOutApp](#new-salesforcelightningoutapp), [New-SalesforceLightningTest](#new-salesforcelightningtest), [New-SalesforceStaticResource](#new-salesforcestaticresource), [New-SalesforceUiBundle](#new-salesforceuibundle), [New-SalesforceUiEmbedding](#new-salesforceuiembedding), [New-SalesforceVisualforceComponent](#new-salesforcevisualforcecomponent), [New-SalesforceVisualforcePage](#new-salesforcevisualforcepage)

## Jest tests

### Debug-SalesforceJest

#### Synopsis

Runs the LWC Jest tests of the current project in debug mode.

#### Syntax

```powershell
Debug-SalesforceJest [<CommonParameters>]
```

#### Description

Runs npm run test:unit:debug in the current folder, so the project's package.json must define that script (the sfdx project template does). Output is returned as text.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Debug-SalesforceJest
```

Start the Jest tests with the Node debugger.

#### Remarks

- To see the examples, type: "Get-Help Debug-SalesforceJest -Examples"
- For more information, type: "Get-Help Debug-SalesforceJest -Detailed"
- For technical information, type: "Get-Help Debug-SalesforceJest -Full"
- For online help, type: "Get-Help Debug-SalesforceJest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Install-SalesforceJest

#### Synopsis

Installs the LWC Jest test runner into the current project.

#### Syntax

```powershell
Install-SalesforceJest [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs yarn add -D @salesforce/sfdx-lwc-jest when yarn is on the PATH, otherwise npm install -D @salesforce/sfdx-lwc-jest. This downloads and runs code from the package registry. Node.js is required.

#### Parameters

- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Install-SalesforceJest
```

Add the Jest runner as a dev dependency.

#### Remarks

- To see the examples, type: "Get-Help Install-SalesforceJest -Examples"
- For more information, type: "Get-Help Install-SalesforceJest -Detailed"
- For technical information, type: "Get-Help Install-SalesforceJest -Full"
- For online help, type: "Get-Help Install-SalesforceJest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceJestTest

#### Synopsis

Writes a starter Jest test for a Lightning web component.

#### Syntax

```powershell
New-SalesforceJestTest [-LwcName] <String> [[-ProjectPath] <String>] [-Force] [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI (the old sf force lightning lwc test create command was removed). It writes &lt;name&gt;.test.js into the component's __tests__ folder, with a test that renders the component. It refuses to overwrite an existing test unless you pass -Force.

#### Parameters

- `-LwcName` (String, required): Name of the Lightning web component (letters, digits and underscores, starting with a letter). Its folder must exist under force-app/main/default/lwc. Required.
- `-ProjectPath` (String): Root folder of the Salesforce DX project. It must exist. Default: ..
- `-Force` (switch): Overwrite the test file if it already exists.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> New-SalesforceJestTest -LwcName accountCard -ProjectPath .
```

Create force-app/main/default/lwc/accountCard/__tests__/accountCard.test.js.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceJestTest -Examples"
- For more information, type: "Get-Help New-SalesforceJestTest -Detailed"
- For technical information, type: "Get-Help New-SalesforceJestTest -Full"
- For online help, type: "Get-Help New-SalesforceJestTest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceJest

#### Synopsis

Runs the LWC Jest tests of the current project once.

#### Syntax

```powershell
Test-SalesforceJest [<CommonParameters>]
```

#### Description

Runs npm run test:unit in the current folder, so the project's package.json must define that script.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Test-SalesforceJest
```

Run every Jest test.

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceJest -Examples"
- For more information, type: "Get-Help Test-SalesforceJest -Detailed"
- For technical information, type: "Get-Help Test-SalesforceJest -Full"
- For online help, type: "Get-Help Test-SalesforceJest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Watch-SalesforceJest

#### Synopsis

Runs the LWC Jest tests and re-runs them when files change.

#### Syntax

```powershell
Watch-SalesforceJest [<CommonParameters>]
```

#### Description

Runs npm run test:unit:watch in the current folder, so the project's package.json must define that script. It keeps running until you stop it.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Watch-SalesforceJest
```

Watch mode for Jest.

#### Remarks

- To see the examples, type: "Get-Help Watch-SalesforceJest -Examples"
- For more information, type: "Get-Help Watch-SalesforceJest -Detailed"
- For technical information, type: "Get-Help Watch-SalesforceJest -Full"
- For online help, type: "Get-Help Watch-SalesforceJest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Project configuration

### Disable-SalesforceSourceTracking

#### Synopsis

Turns source tracking off for an org.

#### Syntax

```powershell
Disable-SalesforceSourceTracking [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org disable tracking. After it, deploy and retrieve no longer report what changed between your project and the org, and source tracking may not be possible to turn on again for that org. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question.

#### Parameters

- `-NoPrompt` (switch): Don't ask for confirmation. The CLI command has no prompt flag, so this only skips the PowerShell confirmation; it does not turn off -WhatIf.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org disable tracking`

#### Examples

```powershell
PS> Disable-SalesforceSourceTracking -TargetOrg dev1 -WhatIf
```

Preview the change without making it.

#### Remarks

- To see the examples, type: "Get-Help Disable-SalesforceSourceTracking -Examples"
- For more information, type: "Get-Help Disable-SalesforceSourceTracking -Detailed"
- For technical information, type: "Get-Help Disable-SalesforceSourceTracking -Full"
- For online help, type: "Get-Help Disable-SalesforceSourceTracking -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Enable-SalesforceSourceTracking

#### Synopsis

Turns source tracking on for an org that allows it.

#### Syntax

```powershell
Enable-SalesforceSourceTracking [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org enable tracking. Source tracking lets deploy and retrieve report what changed between your project and the org. It can be enabled only in an org that supports it, such as a sandbox that was created with source tracking turned off. Supports -WhatIf.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org enable tracking`

#### Examples

```powershell
PS> Enable-SalesforceSourceTracking -TargetOrg dev1
```

Turn source tracking on for dev1.

#### Remarks

- To see the examples, type: "Get-Help Enable-SalesforceSourceTracking -Examples"
- For more information, type: "Get-Help Enable-SalesforceSourceTracking -Detailed"
- For technical information, type: "Get-Help Enable-SalesforceSourceTracking -Full"
- For online help, type: "Get-Help Enable-SalesforceSourceTracking -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceConfiguration

#### Synopsis

Lists the Salesforce CLI configuration variables that are set.

#### Syntax

```powershell
Get-SalesforceConfiguration [<CommonParameters>]
```

#### Description

Runs sf config list and returns one object per variable (name, value, location: Local or Global).

#### Salesforce CLI

- `sf config list`

#### Examples

```powershell
PS> Get-SalesforceConfiguration
```

Every variable that is set.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceConfiguration -Examples"
- For more information, type: "Get-Help Get-SalesforceConfiguration -Detailed"
- For technical information, type: "Get-Help Get-SalesforceConfiguration -Full"
- For online help, type: "Get-Help Get-SalesforceConfiguration -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceTargetDevHub

#### Synopsis

Shows the default Dev Hub configured for the CLI.

#### Syntax

```powershell
Get-SalesforceTargetDevHub [-Global] [<CommonParameters>]
```

#### Description

Runs sf config get target-dev-hub and returns the value with where it is set (Local or Global). With -Global only the global setting is returned.

#### Parameters

- `-Global` (switch): Return only the global value (set for the whole computer), not a project-local one. The filter runs in PowerShell.

#### Salesforce CLI

- `sf config get`

#### Examples

```powershell
PS> Get-SalesforceTargetDevHub
```

The Dev Hub that new scratch orgs are created from.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceTargetDevHub -Examples"
- For more information, type: "Get-Help Get-SalesforceTargetDevHub -Detailed"
- For technical information, type: "Get-Help Get-SalesforceTargetDevHub -Full"
- For online help, type: "Get-Help Get-SalesforceTargetDevHub -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceTargetOrg

#### Synopsis

Shows the default target org configured for the CLI.

#### Syntax

```powershell
Get-SalesforceTargetOrg [-Global] [<CommonParameters>]
```

#### Description

Runs sf config get target-org and returns the value with where it is set (Local or Global). With -Global only the global setting is returned.

#### Parameters

- `-Global` (switch): Return only the global value (set for the whole computer), not a project-local one. The filter runs in PowerShell.

#### Salesforce CLI

- `sf config get`

#### Examples

```powershell
PS> Get-SalesforceTargetOrg
```

The org that cmdlets use when you give no -TargetOrg.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceTargetOrg -Examples"
- For more information, type: "Get-Help Get-SalesforceTargetOrg -Detailed"
- For technical information, type: "Get-Help Get-SalesforceTargetOrg -Full"
- For online help, type: "Get-Help Get-SalesforceTargetOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceProject

#### Synopsis

Generates a new Salesforce DX project.

#### Syntax

```powershell
New-SalesforceProject [-Name] <String> [[-Template] <String>] [[-DefaultUserName] <String>] [[-OutputDirectory] <String>] [[-DefaultPackageDirectory] <String>] [[-Namespace] <String>] [-GenerateManifest] [[-LwcLanguage] <String>] [<CommonParameters>]
```

#### Description

Runs sf template generate project and creates the project folder with sfdx-project.json and the standard layout.

#### Parameters

- `-Name` (String, required): Name of the generated project. Passed to sf as --name. Required.
- `-Template` (String): Template to use for project creation. Passed to sf as --template. Default: standard. Valid values: standard, empty, analytics, reactinternalapp, reactexternalapp, angularinternalapp, angularexternalapp, vueinternalapp, agent.
- `-DefaultUserName` (String): A user name or alias to set as the default target org (target-org) after the project is created. psfdx does this with Set-SalesforceTargetOrg; it is not a flag of the CLI command.
- `-OutputDirectory` (String): Directory for saving the created files. Passed to sf as --output-dir.
- `-DefaultPackageDirectory` (String): Default package directory name. Passed to sf as --default-package-dir.
- `-Namespace` (String): Namespace associated with this project and any connected scratch orgs. Passed to sf as --namespace.
- `-GenerateManifest` (switch): Generate a manifest (package.xml) for change-set based development. Adds --manifest.
- `-LwcLanguage` (String): Language of the Lightning web components the project is set up for. Passed to sf as --lwc-language. Valid values: javascript, typescript. The CLI default is javascript.

#### Salesforce CLI

- `sf template generate project`

#### Examples

```powershell
PS> New-SalesforceProject -Name my-project -Template standard
PS> A standard project in a new folder.
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceProject -Examples"
- For more information, type: "Get-Help New-SalesforceProject -Detailed"
- For technical information, type: "Get-Help New-SalesforceProject -Full"
- For online help, type: "Get-Help New-SalesforceProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceTargetDevHub

#### Synopsis

Clears the default Dev Hub setting.

#### Syntax

```powershell
Remove-SalesforceTargetDevHub [-Global] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf config unset target-dev-hub, locally or with -Global for the whole computer. Only configuration changes; no org is touched. Returns the CLI's list of successes.

#### Parameters

- `-Global` (switch): Clear the global setting instead of the one for the current project. Adds --global.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf config unset`

#### Examples

```powershell
PS> Remove-SalesforceTargetDevHub -Global
```

Forget the global default Dev Hub.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceTargetDevHub -Examples"
- For more information, type: "Get-Help Remove-SalesforceTargetDevHub -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceTargetDevHub -Full"
- For online help, type: "Get-Help Remove-SalesforceTargetDevHub -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceTargetOrg

#### Synopsis

Clears the default target org setting.

#### Syntax

```powershell
Remove-SalesforceTargetOrg [-Global] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf config unset target-org, locally or with -Global for the whole computer. Only configuration changes; no org is touched. Returns the CLI's list of successes.

#### Parameters

- `-Global` (switch): Clear the global setting instead of the one for the current project. Adds --global.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf config unset`

#### Examples

```powershell
PS> Remove-SalesforceTargetOrg
```

Forget the project's default target org.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceTargetOrg -Examples"
- For more information, type: "Get-Help Remove-SalesforceTargetOrg -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceTargetOrg -Full"
- For online help, type: "Get-Help Remove-SalesforceTargetOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Set-SalesforceTargetDevHub

#### Synopsis

Sets the default Dev Hub.

#### Syntax

```powershell
Set-SalesforceTargetDevHub [-Value] <String> [-Global] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf config set target-dev-hub=&lt;value&gt;, for the current project or with -Global for the whole computer. Returns the CLI's list of successes.

#### Parameters

- `-Value` (String, required): Username or alias of the Dev Hub org. Required.
- `-Global` (switch): Set it for the whole computer instead of the current project. Adds --global.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf config set`

#### Examples

```powershell
PS> Set-SalesforceTargetDevHub -Value devhub -Global
```

Use the org with alias devhub as the Dev Hub everywhere.

#### Remarks

- To see the examples, type: "Get-Help Set-SalesforceTargetDevHub -Examples"
- For more information, type: "Get-Help Set-SalesforceTargetDevHub -Detailed"
- For technical information, type: "Get-Help Set-SalesforceTargetDevHub -Full"
- For online help, type: "Get-Help Set-SalesforceTargetDevHub -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Set-SalesforceTargetOrg

#### Synopsis

Sets the default target org.

#### Syntax

```powershell
Set-SalesforceTargetOrg [-Value] <String> [-Global] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf config set target-org=&lt;value&gt;, for the current project or with -Global for the whole computer. Cmdlets that take -TargetOrg then use this org when you do not give one. Returns the CLI's list of successes.

#### Parameters

- `-Value` (String, required): Username or alias of the org to use by default. Required.
- `-Global` (switch): Set it for the whole computer instead of the current project. Adds --global.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf config set`

#### Examples

```powershell
PS> Set-SalesforceTargetOrg -Value dev1
```

Make dev1 the default for this project.

#### Remarks

- To see the examples, type: "Get-Help Set-SalesforceTargetOrg -Examples"
- For more information, type: "Get-Help Set-SalesforceTargetOrg -Detailed"
- For technical information, type: "Get-Help Set-SalesforceTargetOrg -Full"
- For online help, type: "Get-Help Set-SalesforceTargetOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-settings>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Apex

### Get-SalesforceApexClass

#### Synopsis

Gets an Apex class, including its source, from an org.

#### Syntax

```powershell
Get-SalesforceApexClass [-Name] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Queries ApexClass (Id, Name, Body) through the Tooling API with Select-SalesforceRecords. The name is matched exactly and escaped as a SOQL literal; at most one class is returned.

#### Parameters

- `-Name` (String, required): Exact name of the Apex class. Required.
- `-TargetOrg` (String): Username or alias of the org to query. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> (Get-SalesforceApexClass -Name MyService -TargetOrg dev1).Body
```

The source code of MyService.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceApexClass -Examples"
- For more information, type: "Get-Help Get-SalesforceApexClass -Detailed"
- For technical information, type: "Get-Help Get-SalesforceApexClass -Full"
- For online help, type: "Get-Help Get-SalesforceApexClass -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceApexCompileStatus

#### Synopsis

Lists the Apex classes and triggers in an org that do not compile cleanly.

#### Syntax

```powershell
Get-SalesforceApexCompileStatus [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex get compile-status. It returns the compile results of only the Apex classes and triggers that are invalid or have warnings, instead of compiling the whole org, so it is a quick check after a deploy or an upgrade. It only reads. No result means that everything compiles.

#### Parameters

- `-TargetOrg` (String): 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 apex get compile-status`

#### Examples

```powershell
PS> Get-SalesforceApexCompileStatus -TargetOrg dev1
```

The classes and triggers in dev1 with compile errors or warnings.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceApexCompileStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceApexCompileStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceApexCompileStatus -Full"
- For online help, type: "Get-Help Get-SalesforceApexCompileStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceApexTestResult

#### Synopsis

Gets the results of an Apex test run by its TestRunId (sf apex get test).

#### Syntax

```powershell
Get-SalesforceApexTestResult [-TestRunId] <String> [-CodeCoverage] [-CodeCoverageDetailed] [-Concise] [[-OutputDirectory] <String>] [[-ResultFormat] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Returns one object: TestRunId, Summary (outcome, counts, times), Tests (one per test method with Outcome, RunTime, Message and StackTrace), Coverage (only with -CodeCoverage, and only if the run was started with coverage) and Completed. A run that is still queued or processing returns Completed = $false at once (the status is checked with a query first, because the CLI itself would wait) and does not throw; use Wait-SalesforceApexTest to wait. A finished run with failing tests writes the object and then throws PsfdxTestsFailed (TargetObject is the summary). Coverage is returned, never judged: there is no threshold here.

#### Parameters

- `-TestRunId` (String, required): ID of the test run. Passed to sf as --test-run-id. Required.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-CodeCoverageDetailed` (switch): Display detailed code coverage per test. Adds --detailed-coverage.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-OutputDirectory` (String): Directory in which to store test result files. Passed to sf as --output-dir.
- `-ResultFormat` (String): Format of the results. Passed to sf as --result-format. Default: json, which returns the object described above. With human, tap or junit the CLI's text is returned as it is, and a run that is still queued or processing returns nothing but a warning. Valid values: human, tap, junit, json.
- `-TargetOrg` (String): 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 apex get test`

#### Examples

```powershell
PS> $r = Get-SalesforceApexTestResult -TestRunId 707xx0000000001 -CodeCoverage -TargetOrg myorg; $r.Tests | Where-Object Outcome -ne 'Pass'
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceApexTestResult -Examples"
- For more information, type: "Get-Help Get-SalesforceApexTestResult -Detailed"
- For technical information, type: "Get-Help Get-SalesforceApexTestResult -Full"
- For online help, type: "Get-Help Get-SalesforceApexTestResult -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceCodeCoverage

#### Synopsis

Shows Apex code coverage recorded in an org: per test method, or combined per class and trigger with -Aggregate.

#### Syntax

```powershell
Get-SalesforceCodeCoverage [[-ApexClassOrTrigger] <String>] [[-TargetOrg] <String>] [-Aggregate] [[-Threshold] <Double>] [-IncludeMissing] [<CommonParameters>]
```

#### Description

Without -Aggregate (the default, unchanged from earlier versions) it queries the Tooling API object ApexCodeCoverage and returns one object per class or trigger and test method: ApexClassOrTrigger, ApexTestClass, TestMethodName, CodeCoverage (a percentage string), CodeCoverageOK (true at 75 percent or more), NumLinesCovered and NumLinesUncovered. These are the lines one test method covered, so averaging them does not give a class's coverage.

With -Aggregate it queries ApexCodeCoverageAggregate, the org's combined coverage from every test run, and joins it to ApexClass and ApexTrigger. It returns one object per class or trigger with Name, Id, Type (ApexClass or ApexTrigger), NamespacePrefix, NumLinesCovered, NumLinesUncovered, NumLines, CoveragePercent and Status. CoveragePercent is NumLinesCovered divided by NumLines, as a number from 0 to 100 rounded to two decimal places; it is never an average of test percentages. Status is Covered; NoExecutableLines when NumLines is 0 (CoveragePercent is then $null, not 0 or 100); or NoCoverageData when there is no aggregate row because no test has run the class or trigger, or it is a test class. NoCoverageData rows are returned only with -IncludeMissing, and their counts and CoveragePercent are $null.

-Threshold (with -Aggregate) returns only classes and triggers below that percentage: CoveragePercent strictly less than the value, so exactly 75 passes a threshold of 75. NoExecutableLines rows are never returned by -Threshold. NoCoverageData rows are returned by -Threshold when -IncludeMissing is given, because Salesforce counts them as uncovered.

-ApexClassOrTrigger filters the result in PowerShell after the query, ignoring case: by class, trigger or test class name per test, or by class or trigger name with -Aggregate.

#### Parameters

- `-ApexClassOrTrigger` (String): Optional. Keep only rows for this class or trigger (or, without -Aggregate, this test class). The filter runs in PowerShell, after the query.
- `-TargetOrg` (String): Username or alias of the org to query. If omitted, the Salesforce CLI uses the default target org.
- `-Aggregate` (switch): Optional switch. Return the combined coverage of each class and trigger (ApexCodeCoverageAggregate) instead of per-test-method rows.
- `-Threshold` (Double): Optional, with -Aggregate only. A percentage from 0 to 100. Returns only classes and triggers whose CoveragePercent is below this value (strictly less than). See the description for rows with no executable lines or no coverage data.
- `-IncludeMissing` (switch): Optional switch, with -Aggregate only. Also return classes and triggers that have no aggregate coverage row, with Status NoCoverageData. Test classes have no coverage row, so they appear too.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceCodeCoverage -Aggregate -Threshold 75 -TargetOrg dev1 | Sort-Object CoveragePercent | Select-Object Name, Type, CoveragePercent, NumLinesUncovered
```

Classes and triggers below 75 percent coverage, lowest first.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceCodeCoverage -Examples"
- For more information, type: "Get-Help Get-SalesforceCodeCoverage -Detailed"
- For technical information, type: "Get-Help Get-SalesforceCodeCoverage -Full"
- For online help, type: "Get-Help Get-SalesforceCodeCoverage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_apexcodecoverageaggregate.htm>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceApex

#### Synopsis

Runs the anonymous Apex in a file against an org.

#### Syntax

```powershell
Invoke-SalesforceApex [-ApexFile] <String> [[-DebugLevel] <String>] [[-CategoryLevel] <String[]>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex run --file. The code executes in the org with your user's permissions and can change data, so review it first. Returns the execution result (success, compile and run problems, and the debug log).

#### Parameters

- `-ApexFile` (String, required): Path of the local file that holds the Apex statements to run. Passed to sf as --file. Required.
- `-DebugLevel` (String): Debug level for the debug log that the run creates in the org. Passed to sf as --debug-level. Valid values: NONE, DEBUGONLY, DB, PROFILING, CALLOUT, DETAIL. Use it instead of -CategoryLevel, not with it.
- `-CategoryLevel` (String[]): Log level for one log category of that debug log, written as Category=Level, for example ApexCode=FINEST. Give the parameter several times, or a list, for several categories. Each one is passed to sf as its own --category-level. Use it instead of -DebugLevel, not with it.
- `-TargetOrg` (String): 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 apex run`

#### Examples

```powershell
PS> Invoke-SalesforceApex -ApexFile .\scripts\apex\hello.apex -TargetOrg dev1
```

Run the script.

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceApex -Examples"
- For more information, type: "Get-Help Invoke-SalesforceApex -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceApex -Full"
- For online help, type: "Get-Help Invoke-SalesforceApex -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceApexClass

#### Synopsis

Generates a new Apex class in the project.

#### Syntax

```powershell
New-SalesforceApexClass [-Name] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf template generate apex class and writes the .cls and .cls-meta.xml files. The output folder must already exist.

#### Parameters

- `-Name` (String, required): Name of the generated Apex class. Passed to sf as --name. Required.
- `-Template` (String): Template to use for file creation. Passed to sf as --template. Default: DefaultApexClass. Valid values: DefaultApexClass, ApexUnitTest, InboundEmailService, ApexException, BasicUnitTest, Batchable, Queueable.
- `-OutputDirectory` (String): Directory for saving the created files. Passed to sf as --output-dir.

#### Salesforce CLI

- `sf template generate apex class`

#### Examples

```powershell
PS> New-SalesforceApexClass -Name AccountService -OutputDirectory force-app/main/default/classes
PS> A default class in the usual folder.
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceApexClass -Examples"
- For more information, type: "Get-Help New-SalesforceApexClass -Detailed"
- For technical information, type: "Get-Help New-SalesforceApexClass -Full"
- For online help, type: "Get-Help New-SalesforceApexClass -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceApexTrigger

#### Synopsis

Generates a new Apex trigger in the project.

#### Syntax

```powershell
New-SalesforceApexTrigger [-Name] <String> [[-Event] <String>] [[-SObject] <String>] [[-Template] <String>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf template generate apex trigger and writes the .trigger and .trigger-meta.xml files. The output folder must already exist.

#### Parameters

- `-Name` (String, required): Name of the generated Apex trigger. Passed to sf as --name. Required.
- `-Event` (String): The trigger event. Default: before insert. Passed to sf as --event. Default: before insert. Valid values: before insert, before update, before delete, after insert, after update, after delete, after undelete.
- `-SObject` (String): Salesforce object to generate a trigger on. Passed to sf as --sobject.
- `-Template` (String): Template to use. Passed to sf as --template. Valid value: ApexTrigger, which is also the CLI default.
- `-OutputDirectory` (String): Directory for saving the created files. Passed to sf as --output-dir.

#### Salesforce CLI

- `sf template generate apex trigger`

#### Examples

```powershell
PS> New-SalesforceApexTrigger -Name AccountTrigger -SObject Account -Event 'before insert'
PS> A before-insert trigger on Account.
```

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceApexTrigger -Examples"
- For more information, type: "Get-Help New-SalesforceApexTrigger -Detailed"
- For technical information, type: "Get-Help New-SalesforceApexTrigger -Full"
- For online help, type: "Get-Help New-SalesforceApexTrigger -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceApexTest

#### Synopsis

Starts an Apex test run in an org and returns its TestRunId without waiting (sf apex run test).

#### Syntax

```powershell
Start-SalesforceApexTest [[-ClassName] <String[]>] [[-TestName] <String[]>] [[-SuiteName] <String[]>] [[-TestLevel] <String>] [-CodeCoverage] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Name tests with -ClassName (all tests in the classes), -TestName (Class.method) or -SuiteName, one kind at a time, or give none to run the local tests. Salesforce only records code coverage for a run that asked for it, so give -CodeCoverage here if you will want coverage later; asking only when you fetch the results retrieves nothing new. The returned TestRunId works from any later session on any computer: pass it to Get-SalesforceApexTestResult or Wait-SalesforceApexTest. To run and wait in one call use Test-SalesforceApex.

#### Parameters

- `-ClassName` (String[]): Apex test classes to run. Passed as --class-names, one flag per class. Cannot be combined with -TestName or -SuiteName.
- `-TestName` (String[]): Individual test methods to run, written Class.method. Passed as --tests, one flag per test. Cannot be combined with -ClassName or -SuiteName.
- `-SuiteName` (String[]): Apex test suites to run. Passed as --suite-names, one flag per suite. Cannot be combined with -ClassName or -TestName.
- `-TestLevel` (String): Optional. Which tests run. Passed to sf as --test-level. Valid values: RunLocalTests, RunAllTestsInOrg, RunSpecifiedTests. When omitted psfdx passes no --test-level and the CLI default applies: the named classes, tests or suites if you give any, otherwise RunLocalTests. Naming classes, tests or suites needs RunSpecifiedTests or no -TestLevel.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-TargetOrg` (String): 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 apex run test`

#### Examples

```powershell
PS> $run = Start-SalesforceApexTest -TestLevel RunLocalTests -CodeCoverage -TargetOrg myorg; $run.TestRunId
```

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceApexTest -Examples"
- For more information, type: "Get-Help Start-SalesforceApexTest -Detailed"
- For technical information, type: "Get-Help Start-SalesforceApexTest -Full"
- For online help, type: "Get-Help Start-SalesforceApexTest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceApex

#### Synopsis

Runs Apex tests in an org and returns the result.

#### Syntax

```powershell
Test-SalesforceApex [[-ClassName] <String>] [[-TestName] <String>] [[-ResultFormat] <String>] [-Concise] [-CodeCoverage] [-CodeCoverageDetailed] [[-WaitMinutes] <Int32>] [[-OutputDirectory] <String>] [-TestsInProject] [[-PollIntervalSeconds] <Int32>] [-Synchronous] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex run test (waiting up to -WaitMinutes) and returns the result in the format you choose. -TestsInProject runs the test classes found in the local project. With the default json format the result is returned as an object. For a run that returns a run ID to poll, use Start-SalesforceApexTest.

#### Parameters

- `-ClassName` (String): Test class to run. psfdx passes it as --tests &lt;ClassName&gt;, or as --tests &lt;ClassName&gt;.&lt;TestName&gt; when -TestName is also given. Ignored with -TestsInProject.
- `-TestName` (String): A single test method to run, used together with -ClassName; psfdx passes --tests &lt;ClassName&gt;.&lt;TestName&gt;. Without -ClassName it has no effect. Ignored with -TestsInProject.
- `-ResultFormat` (String): Format of the test results. Passed to sf as --result-format. Default: json. Valid values: human, tap, junit, json.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-CodeCoverageDetailed` (switch): Display detailed code coverage per test. Adds --detailed-coverage.
- `-WaitMinutes` (Int32): Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently. Passed to sf as --wait. Default: 10.
- `-OutputDirectory` (String): Directory in which to store test run files. Passed to sf as --output-dir.
- `-TestsInProject` (switch): Run every Apex test class found in the local project. psfdx reads the project folder and passes one --tests &lt;class&gt; per class it finds, so there is no matching CLI flag. The cmdlet stops if it finds none. It takes the place of -ClassName and -TestName.
- `-PollIntervalSeconds` (Int32): Number of seconds to wait between checks while the tests run. Passed to sf as --poll-interval.
- `-Synchronous` (switch): Run the test methods of a single Apex class synchronously, so the command waits for the results; without it the tests run asynchronously. It needs -ClassName and cannot be used with -TestsInProject or -TestName. Adds --synchronous.
- `-TargetOrg` (String): 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 apex run test`

#### Examples

```powershell
PS> Test-SalesforceApex -ClassName AccountServiceTest -CodeCoverage -TargetOrg dev1
```

Run one test class with coverage.

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceApex -Examples"
- For more information, type: "Get-Help Test-SalesforceApex -Detailed"
- For technical information, type: "Get-Help Test-SalesforceApex -Full"
- For online help, type: "Get-Help Test-SalesforceApex -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Wait-SalesforceApexTest

#### Synopsis

Waits for an Apex test run to finish and returns its results.

#### Syntax

```powershell
Wait-SalesforceApexTest [-TestRunId] <String> [[-TimeoutMinutes] <Int32>] [[-PollSeconds] <Int32>] [-CodeCoverage] [-CodeCoverageDetailed] [-Concise] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Polls Get-SalesforceApexTestResult every -PollSeconds until the run is no longer queued or processing, then returns the same object. If -TimeoutMinutes pass first it throws PsfdxTestRunTimeout, whose TargetObject is the TestRunId, and the run carries on in the org. Failing tests and CLI errors surface exactly as for Get-SalesforceApexTestResult.

#### Parameters

- `-TestRunId` (String, required): ID of the test run to wait for, as returned by Start-SalesforceApexTest or Test-SalesforceApex. It must start with 707. Required.
- `-TimeoutMinutes` (Int32): How long to wait, in minutes, before giving up with PsfdxTestRunTimeout. The run carries on in the org. Default 10. Default: 10. Range: 1 to 1440.
- `-PollSeconds` (Int32): Seconds to wait between checks of the run's status. Default 10. Default: 10. Range: 1 to 600.
- `-CodeCoverage` (switch): Include code coverage in the result. Passed on to Get-SalesforceApexTestResult as --code-coverage; the run must have been started with coverage.
- `-CodeCoverageDetailed` (switch): Include line-by-line code coverage. Passed on to Get-SalesforceApexTestResult as --detailed-coverage.
- `-Concise` (switch): Show only failing tests in human-readable output. Passed on to Get-SalesforceApexTestResult as --concise.
- `-OutputDirectory` (String): Folder to write the result files to. Passed on to Get-SalesforceApexTestResult as --output-dir.
- `-TargetOrg` (String): Username or alias of the org the run is in. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> $run = Start-SalesforceApexTest -TargetOrg myorg; Wait-SalesforceApexTest -TestRunId $run.TestRunId -TimeoutMinutes 30 -CodeCoverage -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Wait-SalesforceApexTest -Examples"
- For more information, type: "Get-Help Wait-SalesforceApexTest -Detailed"
- For technical information, type: "Get-Help Wait-SalesforceApexTest -Full"
- For online help, type: "Get-Help Wait-SalesforceApexTest -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Watch-SalesforceApex

#### Synopsis

Runs Apex tests and deploys automatically when you save an Apex file.

#### Syntax

```powershell
Watch-SalesforceApex [[-ProjectFolder] <String>] [[-CooldownMilliseconds] <Int32>] [-IgnoreErrors] [<CommonParameters>]
```

#### Description

Watches the project folder with a file system watcher. On each change to an Apex class or trigger file it deploys that one component and, when it finds test classes that reference it in the project, runs them as part of the deployment. It keeps running until you press Ctrl+C. The deployment goes to the default target org; there is no -TargetOrg.

#### Parameters

- `-ProjectFolder` (String): Folder of the Salesforce DX project to watch. Defaults to the current folder. It must exist.
- `-CooldownMilliseconds` (Int32): Ignore repeat events for the same file within this many milliseconds. Default 300. Default: 300.
- `-IgnoreErrors` (switch): Keep watching after a deploy or test fails instead of stopping.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Watch-SalesforceApex -ProjectFolder .
```

Deploy and test on every save.

#### Remarks

- To see the examples, type: "Get-Help Watch-SalesforceApex -Examples"
- For more information, type: "Get-Help Watch-SalesforceApex -Detailed"
- For technical information, type: "Get-Help Watch-SalesforceApex -Full"
- For online help, type: "Get-Help Watch-SalesforceApex -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Code Analyzer

### Get-SalesforceCodeAnalyzerConfiguration

#### Synopsis

Shows the current Code Analyzer configuration as YAML.

#### Syntax

```powershell
Get-SalesforceCodeAnalyzerConfiguration [[-Workspace] <String[]>] [[-Target] <String[]>] [[-RuleSelector] <String[]>] [[-ConfigurationFile] <String>] [[-OutputFile] <String>] [-IncludeUnmodifiedRules] [-NoSuppressions] [<CommonParameters>]
```

#### Description

Runs sf code-analyzer config and returns the configuration as one YAML string: the top-level settings and the engine and rule overrides for the selected rules, with any code-analyzer.yml in the current folder (or -ConfigurationFile) applied. The CLI has no --json flag, so the YAML is read from a file. Give -OutputFile to keep that file, for example to save the state as the new code-analyzer.yml (the CLI keeps the values and overwrites the comments); without it a temporary file is used and removed. A plugin or engine failure throws the CLI message with install guidance.

#### Parameters

- `-Workspace` (String[]): Set of files that make up your workspace. Each is passed to sf as its own --workspace. Each must exist. Passed to sf as --workspace.
- `-Target` (String[]): Subset of files within your workspace to target. Each is passed to sf as its own --target. Passed to sf as --target.
- `-RuleSelector` (String[]): Selection of rules, based on engine name, severity level, rule name, tag, or a combination of criteria. Each is passed to sf as its own --rule-selector. The CLI default is all. Passed to sf as --rule-selector.
- `-ConfigurationFile` (String): Path to an existing configuration file to start from. It must exist. Passed to sf as --config-file.
- `-OutputFile` (String): File to write the configuration state to, in YAML. The folder must exist. An existing file is overwritten. Passed to sf as --output-file.
- `-IncludeUnmodifiedRules` (switch): Also list the rules whose settings have not been changed, in the rule override settings. Adds --include-unmodified-rules.
- `-NoSuppressions` (switch): Leave suppressions out of the output configuration. Adds --no-suppressions.

#### Salesforce CLI

- `sf code-analyzer config`

#### Examples

```powershell
PS> Get-SalesforceCodeAnalyzerConfiguration
```

The YAML for all rules, with the code-analyzer.yml of the current folder applied.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceCodeAnalyzerConfiguration -Examples"
- For more information, type: "Get-Help Get-SalesforceCodeAnalyzerConfiguration -Detailed"
- For technical information, type: "Get-Help Get-SalesforceCodeAnalyzerConfiguration -Full"
- For online help, type: "Get-Help Get-SalesforceCodeAnalyzerConfiguration -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-code-analyzer>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceCodeAnalyzerRule

#### Synopsis

Lists the Code Analyzer rules that match a selector (sf code-analyzer rules).

#### Syntax

```powershell
Get-SalesforceCodeAnalyzerRule [[-RuleSelector] <String[]>] [[-Workspace] <String[]>] [[-Target] <String[]>] [[-ConfigurationFile] <String>] [[-View] <String>] [<CommonParameters>]
```

#### Description

Returns one object per rule (as the CLI reports it: name, engine, severity, tags, description, resources). The CLI has no --json flag, so the rules are read from a temporary JSON report file. With no selector the CLI lists its default rules. A selector such as Recommended, Security, pmd or pmd:Security narrows the list. A plugin or engine failure throws the CLI message with install guidance.

#### Parameters

- `-RuleSelector` (String[]): Selection of rules, based on engine name, severity level, rule name, tag, or a combination of criteria separated by colons. Passed to sf as --rule-selector.
- `-Workspace` (String[]): Set of files that make up your workspace. Passed to sf as --workspace.
- `-Target` (String[]): Subset of files within your workspace that you want to target for analysis. Passed to sf as --target.
- `-ConfigurationFile` (String): Path to the configuration file used to customize the engines and rules. Passed to sf as --config-file.
- `-View` (String): How the CLI displays the rules in the terminal. Passed to sf as --view. Valid values: detail, table. The cmdlet reads the rules from a report file, so this changes only the text the CLI prints, not the returned objects.

#### Salesforce CLI

- `sf code-analyzer rules`

#### Examples

```powershell
PS> Get-SalesforceCodeAnalyzerRule -RuleSelector Security | Select-Object name, engine, severity
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceCodeAnalyzerRule -Examples"
- For more information, type: "Get-Help Get-SalesforceCodeAnalyzerRule -Detailed"
- For technical information, type: "Get-Help Get-SalesforceCodeAnalyzerRule -Full"
- For online help, type: "Get-Help Get-SalesforceCodeAnalyzerRule -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-code-analyzer>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceCodeAnalyzerSyntaxTree

#### Synopsis

Shows the syntax tree that PMD builds for a source file.

#### Syntax

```powershell
Get-SalesforceCodeAnalyzerSyntaxTree [-File] <String> [[-Language] <String>] [[-Format] <String>] [[-OutputFile] <String>] [<CommonParameters>]
```

#### Description

Runs sf code-analyzer ast-dump. The AST is what PMD sees when it parses the file, which helps you write and debug custom PMD rules. It works for Apex, Visualforce, HTML, XML and JavaScript files, and it needs Java 11 or later. The CLI writes the tree to a file, so psfdx reads that file: with -Format json (the default here) you get one object per node, with its name, attributes, parent and ancestors, as the CLI reports them; with -Format xml you get the raw tree as an XML document. Give -OutputFile to keep the file; without it a temporary file is used and removed.

#### Parameters

- `-File` (String, required): Path of the source file to parse. It must exist and be a file, not a folder. Passed to sf as --file. Required.
- `-Language` (String): Language of the source file. By default the CLI uses apex. Valid values: apex, visualforce, html, xml, javascript. Passed to sf as --language.
- `-Format` (String): Format of the tree. Valid values: json, xml. The CLI default is xml; this cmdlet uses json unless you say otherwise, because it gives objects. Passed to sf as --format.
- `-OutputFile` (String): File to write the tree to. The folder must exist. An existing file is overwritten. Passed to sf as --output-file.

#### Salesforce CLI

- `sf code-analyzer ast-dump`

#### Examples

```powershell
PS> Get-SalesforceCodeAnalyzerSyntaxTree -File .\force-app\main\default\classes\MyClass.cls | Select-Object -First 5
```

The first nodes of an Apex class's tree.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceCodeAnalyzerSyntaxTree -Examples"
- For more information, type: "Get-Help Get-SalesforceCodeAnalyzerSyntaxTree -Detailed"
- For technical information, type: "Get-Help Get-SalesforceCodeAnalyzerSyntaxTree -Full"
- For online help, type: "Get-Help Get-SalesforceCodeAnalyzerSyntaxTree -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-code-analyzer>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Invoke-SalesforceCodeAnalyzer

#### Synopsis

Runs Salesforce Code Analyzer over a workspace and returns the findings as objects (sf code-analyzer run).

#### Syntax

```powershell
Invoke-SalesforceCodeAnalyzer [[-Workspace] <String[]>] [[-Target] <String[]>] [[-RuleSelector] <String[]>] [[-ConfigurationFile] <String>] [[-SeverityThreshold] <String>] [-ThrowOnThreshold] [-IncludeFixes] [-IncludeSuggestions] [-NoSuppressions] [[-TargetOrg] <String>] [[-View] <String>] [[-OutputFile] <String[]>] [<CommonParameters>]
```

#### Description

Returns one object with Passed, ThresholdExceeded, ViolationCount, a count per severity, Violations (one object per finding with Rule, Engine, Severity, Message, File, StartLine, StartColumn, EndLine, EndColumn, Tags, Resources, and Fixes and Suggestions when the CLI reports them), RunDirectory and Versions. With -SeverityThreshold the CLI fails when a finding is at or above that severity. That is a threshold failure, not an error: the findings are still returned (the exit code is non-zero but the report is written) with Passed = $false and ThresholdExceeded = $true. Add -ThrowOnThreshold to turn it into an error (id PsfdxCodeAnalyzerThresholdExceeded, with the result as the target object) so a CI step fails. If the plugin or an engine cannot start there is no report, and the cmdlet always throws (id PsfdxCodeAnalyzerFailed) with the CLI message. The plugin is installed with the Salesforce CLI or with Install-SalesforcePlugin. Engines such as PMD and the Java-based rules need Java 11 or later; the CLI downloads engine dependencies on first use, so the first run can be slow and needs network access.

#### Parameters

- `-Workspace` (String[]): Set of files that make up your workspace. Passed to sf as --workspace.
- `-Target` (String[]): Subset of files within your workspace to be targeted for analysis. Passed to sf as --target.
- `-RuleSelector` (String[]): Selection of rules, based on engine name, severity level, rule name, tag, or a combination of criteria separated by colons. Passed to sf as --rule-selector.
- `-ConfigurationFile` (String): Path to the configuration file used to customize the engines and rules. Passed to sf as --config-file.
- `-SeverityThreshold` (String): Severity level of a found violation that must be met or exceeded to cause this command to fail with a non-zero exit code. Passed to sf as --severity-threshold. Valid values: 1, 2, 3, 4, 5, Critical, High, Moderate, Low, Info.
- `-ThrowOnThreshold` (switch): Throw an error (id PsfdxCodeAnalyzerThresholdExceeded, with the result as its target object) when a finding meets -SeverityThreshold, instead of returning the findings with ThresholdExceeded set. Meant for CI.
- `-IncludeFixes` (switch): Include fix data for the violations that have one. Each violation then has a Fixes property, as the CLI reports it. Adds --include-fixes.
- `-IncludeSuggestions` (switch): Include suggestion data for the violations that have one. Each violation then has a Suggestions property, as the CLI reports it. Adds --include-suggestions.
- `-NoSuppressions` (switch): Do not process inline and bulk suppression markers, so suppressed violations are reported again. Adds --no-suppressions.
- `-TargetOrg` (String): Username or alias of the org that remote analysis engines use, such as the engine that needs an org connection. Passed to sf as --target-org.
- `-View` (String): How the CLI displays the results in the terminal. Passed to sf as --view. Valid values: detail, table. The cmdlet reads the results from a report file, so this changes only the text the CLI prints, not the returned object.
- `-OutputFile` (String[]): Extra files to write the results to, in addition to the object that is returned. The file format follows each extension, such as .csv, .html or .xml. Each one is passed to sf as its own --output-file. The folders must exist.

#### Salesforce CLI

- `sf code-analyzer run`

#### Examples

```powershell
PS> Invoke-SalesforceCodeAnalyzer -Workspace force-app -RuleSelector Recommended -SeverityThreshold 2 -ThrowOnThreshold
```

#### Remarks

- To see the examples, type: "Get-Help Invoke-SalesforceCodeAnalyzer -Examples"
- For more information, type: "Get-Help Invoke-SalesforceCodeAnalyzer -Detailed"
- For technical information, type: "Get-Help Invoke-SalesforceCodeAnalyzer -Full"
- For online help, type: "Get-Help Invoke-SalesforceCodeAnalyzer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-code-analyzer>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Flow and logic tests

### Get-SalesforceFlowTestResult

#### Synopsis

Gets the results of an earlier Flow test run (sf flow get test).

#### Syntax

```powershell
Get-SalesforceFlowTestResult [-TestRunId] <String> [[-ResultFormat] <String>] [-Concise] [-CodeCoverage] [-CodeCoverageDetailed] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Takes the TestRunId that Test-SalesforceFlow returned. Failed tests throw PsfdxTestsFailed and a command that could not run throws PsfdxTestRunInvocationFailed, as for Test-SalesforceFlow. A run that has not finished yet is reported by the CLI as an invocation failure or as its current counts, depending on the CLI version.

#### Parameters

- `-TestRunId` (String, required): ID of the test run. Passed to sf as --test-run-id. Required.
- `-ResultFormat` (String): Format of the test results. Passed to sf as --result-format. Default: json. Valid values: human, tap, junit, json.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-CodeCoverageDetailed` (switch): Not available for flow tests. Adds --detailed-coverage.
- `-OutputDirectory` (String): Directory in which to store test result files. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 flow get test`

#### Examples

```powershell
PS> Get-SalesforceFlowTestResult -TestRunId 707xx0000000001 -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceFlowTestResult -Examples"
- For more information, type: "Get-Help Get-SalesforceFlowTestResult -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFlowTestResult -Full"
- For online help, type: "Get-Help Get-SalesforceFlowTestResult -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-flow>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceLogicTestResult

#### Synopsis

Gets the results of an earlier Flow and Apex test run (sf logic get test).

#### Syntax

```powershell
Get-SalesforceLogicTestResult [-TestRunId] <String> [[-ResultFormat] <String>] [-Concise] [-CodeCoverage] [-CodeCoverageDetailed] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Takes the TestRunId that Test-SalesforceLogic returned. Errors are the same as for Test-SalesforceLogic.

#### Parameters

- `-TestRunId` (String, required): ID of the test run. Passed to sf as --test-run-id. Required.
- `-ResultFormat` (String): Format of the test results. Passed to sf as --result-format. Default: json. Valid values: human, tap, junit, json.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-CodeCoverageDetailed` (switch): Display detailed code coverage per test. Adds --detailed-coverage.
- `-OutputDirectory` (String): Directory in which to store test result files. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 logic get test`

#### Examples

```powershell
PS> Get-SalesforceLogicTestResult -TestRunId 707xx0000000001 -CodeCoverage -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceLogicTestResult -Examples"
- For more information, type: "Get-Help Get-SalesforceLogicTestResult -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLogicTestResult -Full"
- For online help, type: "Get-Help Get-SalesforceLogicTestResult -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceFlow

#### Synopsis

Runs Flow tests in an org (sf flow run test).

#### Syntax

```powershell
Test-SalesforceFlow [[-FlowName] <String[]>] [[-TestName] <String[]>] [[-SuiteName] <String[]>] [[-TestLevel] <String>] [-Synchronous] [[-ResultFormat] <String>] [-Concise] [-CodeCoverage] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

By default the run is asynchronous: the cmdlet returns an object with a TestRunId, and Get-SalesforceFlowTestResult fetches the results later. With -Synchronous (one flow only) it waits and returns the results. Needs the "View All Data" permission.

A finished run returns one object with Summary, Tests and Coverage (Coverage is empty unless -CodeCoverage was given), and TestRunId. Without -Synchronous the CLI starts the run and returns at once.

Failed tests and a command that could not run are different errors. A failed test run writes the result object to the pipeline, then throws an error whose FullyQualifiedErrorId is PsfdxTestsFailed (the CLI summary is the error's TargetObject). Everything else, such as no authorisation or a missing plugin, throws PsfdxTestRunInvocationFailed.

Code coverage is returned but never judged; there is no coverage threshold.

#### Parameters

- `-FlowName` (String[]): Flows to test (--class-names). Cannot be combined with -TestName or -SuiteName.
- `-TestName` (String[]): Specific tests in Flow.Test form (--tests).
- `-SuiteName` (String[]): Test suites to run (--suite-names).
- `-TestLevel` (String): Optional. Which flow tests run. Passed to sf as --test-level. Valid values: RunLocalTests, RunAllTestsInOrg, RunSpecifiedTests. When omitted psfdx passes no --test-level and the CLI default applies: the named flows, tests or suites if you give any, otherwise RunLocalTests. Naming flows, tests or suites needs RunSpecifiedTests or no -TestLevel.
- `-Synchronous` (switch): Run flow tests for one flow synchronously; if not specified, tests are run asynchronously. Adds --synchronous.
- `-ResultFormat` (String): Format of the test results. Passed to sf as --result-format. Default: json. Valid values: human, tap, junit, json.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-OutputDirectory` (String): Directory in which to store test result files. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 flow run test`

#### Examples

```powershell
PS> Test-SalesforceFlow -TestLevel RunLocalTests -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceFlow -Examples"
- For more information, type: "Get-Help Test-SalesforceFlow -Detailed"
- For technical information, type: "Get-Help Test-SalesforceFlow -Full"
- For online help, type: "Get-Help Test-SalesforceFlow -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-flow>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceLogic

#### Synopsis

Runs Flow and Apex tests together in an org (sf logic run test).

#### Syntax

```powershell
Test-SalesforceLogic [[-ClassName] <String[]>] [[-TestName] <String[]>] [[-SuiteName] <String[]>] [[-TestCategory] <String[]>] [[-TestLevel] <String>] [-Synchronous] [[-WaitMinutes] <Int32>] [[-ResultFormat] <String>] [-Concise] [-CodeCoverage] [-CodeCoverageDetailed] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Like Test-SalesforceFlow, but -TestName and -ClassName also accept Apex tests, and -TestCategory picks Apex, Flow or both. The run is asynchronous unless -Synchronous or -WaitMinutes is given; an asynchronous run, or a wait that times out, returns an object with a TestRunId for Get-SalesforceLogicTestResult. Failed tests throw PsfdxTestsFailed; a command that could not run throws PsfdxTestRunInvocationFailed. -TestCategory needs -TestLevel. The command is in beta in the CLI. Test-SalesforceApex still runs Apex alone.

#### Parameters

- `-ClassName` (String[]): Test classes to run. Passed as --class-names. Use only one of -ClassName, -TestName, -SuiteName and -TestCategory.
- `-TestName` (String[]): Individual tests to run: Apex as Class.method, flows as FlowName.TestName. Passed as --tests. Use only one of -ClassName, -TestName, -SuiteName and -TestCategory.
- `-SuiteName` (String[]): Test suites to run. Passed as --suite-names. Use only one of -ClassName, -TestName, -SuiteName and -TestCategory.
- `-TestCategory` (String[]): Run Apex tests, Flow tests or both, with -TestLevel. Passed as --test-category, one flag per category. Use only one of -ClassName, -TestName, -SuiteName and -TestCategory. Valid values: Apex, Flow.
- `-TestLevel` (String): Optional. Which tests run. Passed to sf as --test-level. Valid values: RunLocalTests, RunAllTestsInOrg, RunSpecifiedTests. When omitted psfdx passes no --test-level and the CLI default applies: the named classes, tests or suites if you give any, otherwise RunLocalTests. Naming classes, tests or suites needs RunSpecifiedTests or no -TestLevel, and -TestCategory needs a -TestLevel.
- `-Synchronous` (switch): Runs test methods from a single Apex class synchronously; if not specified, tests are run asynchronously. Adds --synchronous.
- `-WaitMinutes` (Int32): Sets the streaming client socket timeout in minutes; specify a longer wait time if timeouts occur frequently. Passed to sf as --wait. Range: 0 to 1440.
- `-ResultFormat` (String): Format of the test results. Passed to sf as --result-format. Default: json. Valid values: human, tap, junit, json.
- `-Concise` (switch): Display only failed test results; works with human-readable output only. Adds --concise.
- `-CodeCoverage` (switch): Retrieve code coverage results. Adds --code-coverage.
- `-CodeCoverageDetailed` (switch): Display detailed code coverage per test. Adds --detailed-coverage.
- `-OutputDirectory` (String): Directory in which to store test run files. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 logic run test`

#### Examples

```powershell
PS> Test-SalesforceLogic -TestCategory Apex, Flow -TestLevel RunLocalTests -Synchronous -TargetOrg myorg
```

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceLogic -Examples"
- For more information, type: "Get-Help Test-SalesforceLogic -Detailed"
- For technical information, type: "Get-Help Test-SalesforceLogic -Full"
- For online help, type: "Get-Help Test-SalesforceLogic -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Org shapes and snapshots

### Get-SalesforceOrgShapes

#### Synopsis

Lists the org shapes of the orgs this computer is logged in to.

#### Syntax

```powershell
Get-SalesforceOrgShapes [<CommonParameters>]
```

#### Description

Runs sf org list shape and returns one object per shape (the org it came from, the shape ID, its status and when it was created).

#### Salesforce CLI

- `sf org list shape`

#### Examples

```powershell
PS> Get-SalesforceOrgShapes | Format-Table
```

List every shape.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceOrgShapes -Examples"
- For more information, type: "Get-Help Get-SalesforceOrgShapes -Detailed"
- For technical information, type: "Get-Help Get-SalesforceOrgShapes -Full"
- For online help, type: "Get-Help Get-SalesforceOrgShapes -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceOrgSnapshot

#### Synopsis

Shows one scratch org snapshot, including whether it is ready to use.

#### Syntax

```powershell
Get-SalesforceOrgSnapshot [-Snapshot] <String> [[-TargetDevHub] <String>] [<CommonParameters>]
```

#### Description

Runs sf org get snapshot for the snapshot name or ID. Use Get-SalesforceOrgSnapshots to list them all.

#### Parameters

- `-Snapshot` (String, required): Name or ID of the snapshot. Passed to sf as --snapshot. Required.
- `-TargetDevHub` (String): 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 org get snapshot`

#### Examples

```powershell
PS> Get-SalesforceOrgSnapshot -Snapshot Release1 -TargetDevHub devhub
```

Show the status of the snapshot.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceOrgSnapshot -Examples"
- For more information, type: "Get-Help Get-SalesforceOrgSnapshot -Detailed"
- For technical information, type: "Get-Help Get-SalesforceOrgSnapshot -Full"
- For online help, type: "Get-Help Get-SalesforceOrgSnapshot -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceOrgSnapshots

#### Synopsis

Lists the scratch org snapshots of a Dev Hub.

#### Syntax

```powershell
Get-SalesforceOrgSnapshots [[-TargetDevHub] <String>] [<CommonParameters>]
```

#### Description

Runs sf org list snapshot and returns one object per snapshot (name, ID, status, source org and when it was created).

#### Parameters

- `-TargetDevHub` (String): 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 org list snapshot`

#### Examples

```powershell
PS> Get-SalesforceOrgSnapshots -TargetDevHub devhub | Format-Table
```

List the snapshots of the Dev Hub.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceOrgSnapshots -Examples"
- For more information, type: "Get-Help Get-SalesforceOrgSnapshots -Detailed"
- For technical information, type: "Get-Help Get-SalesforceOrgSnapshots -Full"
- For online help, type: "Get-Help Get-SalesforceOrgSnapshots -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceOrgShape

#### Synopsis

Creates an org shape from an org.

#### Syntax

```powershell
New-SalesforceOrgShape [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org create shape. An org shape records the edition, features and settings of the source org, so that scratch orgs can be created to match it (see New-SalesforceScratchOrg -SourceOrgId). The org must have Scratch Org Shape turned on.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org to take the shape from. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org create shape`

#### Examples

```powershell
PS> New-SalesforceOrgShape -TargetOrg prod
```

Create a shape from the prod org.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceOrgShape -Examples"
- For more information, type: "Get-Help New-SalesforceOrgShape -Detailed"
- For technical information, type: "Get-Help New-SalesforceOrgShape -Full"
- For online help, type: "Get-Help New-SalesforceOrgShape -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceOrgSnapshot

#### Synopsis

Creates a scratch org snapshot from an org.

#### Syntax

```powershell
New-SalesforceOrgSnapshot [-SourceOrg] <String> [-SnapshotName] <String> [[-Description] <String>] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org create snapshot. A snapshot is a copy of a scratch org that you can create new scratch orgs from (see New-SalesforceScratchOrg -Snapshot). The snapshot is made in the Dev Hub. Snapshots are a pilot feature of Salesforce. Creation is asynchronous: use Get-SalesforceOrgSnapshot to see when it is ready.

#### Parameters

- `-SourceOrg` (String, required): Username or alias of the scratch org to copy. Passed to sf as --source-org. Required.
- `-SnapshotName` (String, required): Name of the snapshot. Passed to sf as --name. Required.
- `-Description` (String): Description of the snapshot. Passed to sf as --description.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org create snapshot`

#### Examples

```powershell
PS> New-SalesforceOrgSnapshot -SourceOrg my-scratch -SnapshotName Release1 -Description 'Before the upgrade' -TargetDevHub devhub
```

Take a snapshot of a scratch org.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceOrgSnapshot -Examples"
- For more information, type: "Get-Help New-SalesforceOrgSnapshot -Detailed"
- For technical information, type: "Get-Help New-SalesforceOrgSnapshot -Full"
- For online help, type: "Get-Help New-SalesforceOrgSnapshot -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceOrgShape

#### Synopsis

Deletes the org shapes of an org.

#### Syntax

```powershell
Remove-SalesforceOrgShape [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org delete shape. This cannot be undone, and scratch orgs can no longer be created from the deleted shape. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-NoPrompt` (switch): Don't ask for confirmation. Skips the PowerShell confirmation; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-TargetOrg` (String): Username or alias of the org whose shapes are deleted. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org delete shape`

#### Examples

```powershell
PS> Remove-SalesforceOrgShape -TargetOrg prod -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceOrgShape -Examples"
- For more information, type: "Get-Help Remove-SalesforceOrgShape -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceOrgShape -Full"
- For online help, type: "Get-Help Remove-SalesforceOrgShape -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceOrgSnapshot

#### Synopsis

Deletes a scratch org snapshot.

#### Syntax

```powershell
Remove-SalesforceOrgSnapshot [-Snapshot] <String> [-NoPrompt] [[-TargetDevHub] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org delete snapshot. This cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-Snapshot` (String, required): Name or ID of the snapshot to delete. Passed to sf as --snapshot. Required.
- `-NoPrompt` (switch): Don't ask for confirmation. Skips the PowerShell confirmation; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org delete snapshot`

#### Examples

```powershell
PS> Remove-SalesforceOrgSnapshot -Snapshot Release1 -TargetDevHub devhub -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceOrgSnapshot -Examples"
- For more information, type: "Get-Help Remove-SalesforceOrgSnapshot -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceOrgSnapshot -Full"
- For online help, type: "Get-Help Remove-SalesforceOrgSnapshot -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-signups>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Local development servers

### Install-SalesforceLwcDevServer

#### Synopsis

Installs the Salesforce CLI plugin that provides the LWC local dev server.

#### Syntax

```powershell
Install-SalesforceLwcDevServer [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins install @salesforce/plugin-lightning-dev. Start-SalesforceLwcDevServer stops with a message pointing here until the plugin is installed.

#### Parameters

- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins install`

#### Examples

```powershell
PS> Install-SalesforceLwcDevServer
```

Install the plugin.

#### Remarks

- To see the examples, type: "Get-Help Install-SalesforceLwcDevServer -Examples"
- For more information, type: "Get-Help Install-SalesforceLwcDevServer -Detailed"
- For technical information, type: "Get-Help Install-SalesforceLwcDevServer -Full"
- For online help, type: "Get-Help Install-SalesforceLwcDevServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceLwcDevServer

#### Synopsis

Starts the local Lightning dev server for an app, a component or an Experience site.

#### Syntax

```powershell
Start-SalesforceLwcDevServer [[-Mode] <String>] [[-Name] <String>] [[-DeviceType] <String>] [[-DeviceId] <String>] [-ClientSelect] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf lightning dev app, component or site, chosen by -Mode, and keeps running until you stop it. Needs the @salesforce/plugin-lightning-dev plugin (Install-SalesforceLwcDevServer). -DeviceType only applies to -Mode App.

#### Parameters

- `-Mode` (String): What to preview: App (the default), Component or Site. psfdx runs the CLI command with that last word. Default: App. Valid values: App, Component, Site.
- `-Name` (String): Name of the app, component or site to preview. Passed as --name.
- `-DeviceType` (String): Type of device to display the app preview. Passed to sf as --device-type. Valid values: desktop, ios, android. Only with -Mode App.
- `-DeviceId` (String): ID of the mobile device to show the preview on, when -DeviceType is ios or android. By default the CLI uses the first mobile device it finds. Passed to sf as --device-id. Only with -Mode App.
- `-ClientSelect` (switch): Open the component preview without choosing a component first, so you pick one in the browser. Adds --client-select. Only with -Mode Component.
- `-TargetOrg` (String): 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 lightning dev app`
- `sf lightning dev component`
- `sf lightning dev site`

#### Examples

```powershell
PS> Start-SalesforceLwcDevServer -Mode Component -Name accountCard -TargetOrg dev1
```

Preview one component.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceLwcDevServer -Examples"
- For more information, type: "Get-Help Start-SalesforceLwcDevServer -Detailed"
- For technical information, type: "Get-Help Start-SalesforceLwcDevServer -Full"
- For online help, type: "Get-Help Start-SalesforceLwcDevServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-lightning-dev>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceUiBundleDevServer

#### Synopsis

Previews a UI bundle on your computer, live, without deploying it to the org.

#### Syntax

```powershell
Start-SalesforceUiBundleDevServer [[-Name] <String>] [[-Url] <String>] [[-Port] <Int32>] [-Open] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf ui-bundle dev, which starts a local proxy in front of your own development server (such as a Vite server on https://localhost:5173). Pages, static files and hot updates are sent to your server, and Salesforce data and API requests go to the org with your login, so you can work on a UI bundle against real data before you deploy it. It keeps running until you stop it (Ctrl+C), so run it in its own terminal. Nothing is deployed and no org data changes. The command comes from the @salesforce/plugin-ui-bundle-dev plugin, which the CLI installs when it first needs it; if it is missing, install it with Install-SalesforcePlugin.

#### Parameters

- `-Name` (String): Name of the UI bundle to preview. If you leave it out the CLI looks in the project. Passed to sf as --name.
- `-Url` (String): URL where your development server runs, for example https://localhost:5173. It must be an absolute http:// or https:// URL. UI, static and hot update requests are forwarded to it. Passed to sf as --url.
- `-Port` (Int32): Local port the proxy listens on. Valid values: 1 to 65535. Passed to sf as --port.
- `-Open` (switch): Open the proxy URL in your default browser once the server is ready. Adds --open.
- `-TargetOrg` (String): 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 ui-bundle dev`

#### Examples

```powershell
PS> Start-SalesforceUiBundleDevServer -Name myApp -Url https://localhost:5173 -Open -TargetOrg dev1
```

Proxy a local Vite server, with the org's data, and open the browser.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceUiBundleDevServer -Examples"
- For more information, type: "Get-Help Start-SalesforceUiBundleDevServer -Detailed"
- For technical information, type: "Get-Help Start-SalesforceUiBundleDevServer -Full"
- For online help, type: "Get-Help Start-SalesforceUiBundleDevServer -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-ui-bundle-dev>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Component and template generation

### New-SalesforceAnalyticsTemplate

#### Synopsis

Creates the files of a simple CRM Analytics template in the project.

#### Syntax

```powershell
New-SalesforceAnalyticsTemplate [-Name] <String> [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate analytics template. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Analytics template already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Analytics template. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-OutputDirectory` (String): Folder to save the created files in. It must be a folder named waveTemplates, such as force-app/main/default/waveTemplates, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate analytics template`

#### Examples

```powershell
PS> New-SalesforceAnalyticsTemplate -Name SalesDashboard -OutputDirectory force-app/main/default/waveTemplates
```

Generate the Analytics template.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceAnalyticsTemplate -Examples"
- For more information, type: "Get-Help New-SalesforceAnalyticsTemplate -Detailed"
- For technical information, type: "Get-Help New-SalesforceAnalyticsTemplate -Full"
- For online help, type: "Get-Help New-SalesforceAnalyticsTemplate -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceExperienceSite

#### Synopsis

Creates the files of a new Experience Cloud site in the project. Preview.

#### Syntax

```powershell
New-SalesforceExperienceSite [-Name] <String> [-TemplateName] <String> [[-AdminEmail] <String>] [[-UrlPathPrefix] <String>] [[-OutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf template generate digital-experience site. This CLI command is a preview, so its flags, templates and output can change in a later release. It writes the site files into the project; it does not create the site in an org (deploy the files for that). It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput.

#### Parameters

- `-Name` (String, required): Name of the Experience Cloud site. Passed to sf as --name. Required.
- `-TemplateName` (String, required): Template to build the site from. Valid value: Build Your Own (LWR). Passed to sf as --template-name. Required.
- `-AdminEmail` (String): Email address of the site administrator. By default the CLI uses the user name of the authenticated user. Passed to sf as --admin-email.
- `-UrlPathPrefix` (String): URL path prefix of the site. Letters and digits only. Passed to sf as --url-path-prefix.
- `-OutputDirectory` (String): Folder to generate the site files in. Passed to sf as --output-dir.
- `-TargetOrg` (String): 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 template generate digital-experience site`

#### Examples

```powershell
PS> New-SalesforceExperienceSite -Name 'Partner Portal' -TemplateName 'Build Your Own (LWR)' -UrlPathPrefix partners -TargetOrg dev1
```

Generate the files of an LWR site.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceExperienceSite -Examples"
- For more information, type: "Get-Help New-SalesforceExperienceSite -Detailed"
- For technical information, type: "Get-Help New-SalesforceExperienceSite -Full"
- For online help, type: "Get-Help New-SalesforceExperienceSite -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceFlexiPage

#### Synopsis

Creates a FlexiPage (Lightning page) in the project. Beta.

#### Syntax

```powershell
New-SalesforceFlexiPage [-Name] <String> [-Template] <String> [[-SObject] <String>] [[-Label] <String>] [[-Description] <String>] [[-PrimaryField] <String>] [[-SecondaryFields] <String[]>] [[-DetailFields] <String[]>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate flexipage, which writes a record page, app page or home page under a flexipages folder in the output folder. This CLI command is in beta, so its flags and output can change in a later release. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. A record page needs -SObject. If the page already exists the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): API name of the FlexiPage. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Template` (String, required): Kind of page. Valid values: RecordPage, AppPage, HomePage. Passed to sf as --template. Required.
- `-SObject` (String): API name of the object the page is for. Required for a RecordPage. Passed to sf as --sobject.
- `-Label` (String): Label of the page. By default the CLI uses the name. Passed to sf as --label.
- `-Description` (String): Description of the page. Passed to sf as --description.
- `-PrimaryField` (String): Primary field of the highlights header, usually Name. Only for a RecordPage. Passed to sf as --primary-field.
- `-SecondaryFields` (String[]): Secondary fields of the highlights header, at most 11. Each is passed to sf as its own --secondary-fields. Only for a RecordPage. Passed to sf as --secondary-fields.
- `-DetailFields` (String[]): Fields to show in the Details tab, split into two columns. Each is passed to sf as its own --detail-fields. Only for a RecordPage. Passed to sf as --detail-fields.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate flexipage`

#### Examples

```powershell
PS> New-SalesforceFlexiPage -Name Account_Record_Page -Template RecordPage -SObject Account -PrimaryField Name -SecondaryFields Industry, Phone -OutputDirectory force-app/main/default
```

Generate a record page for Account.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceFlexiPage -Examples"
- For more information, type: "Get-Help New-SalesforceFlexiPage -Detailed"
- For technical information, type: "Get-Help New-SalesforceFlexiPage -Full"
- For online help, type: "Get-Help New-SalesforceFlexiPage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningApp

#### Synopsis

Creates the files of a new Aura Lightning app in the project.

#### Syntax

```powershell
New-SalesforceLightningApp [-Name] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning app. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Lightning app already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Lightning app. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Template` (String): Template to use. Valid value: DefaultLightningApp, which is also the CLI default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It must be a folder named aura, such as force-app/main/default/aura, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning app`

#### Examples

```powershell
PS> New-SalesforceLightningApp -Name MyApp -OutputDirectory force-app/main/default/aura
```

Generate the Lightning app.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningApp -Examples"
- For more information, type: "Get-Help New-SalesforceLightningApp -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningApp -Full"
- For online help, type: "Get-Help New-SalesforceLightningApp -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningComponent

#### Synopsis

Creates the files of a new Lightning web component or Aura component in the project.

#### Syntax

```powershell
New-SalesforceLightningComponent [-Name] <String> [[-Type] <String>] [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning component. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the component already exists in the output folder the cmdlet stops, unless you pass -Force. The output folder must be named lwc for a web component and aura for an Aura component.

#### Parameters

- `-Name` (String, required): Name of the component. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Type` (String): Kind of component. Valid values: aura, lwc. The CLI default is lwc. Passed to sf as --type.
- `-Template` (String): Template to use. Valid values: default, analyticsDashboard, analyticsDashboardWithStep, typescript. The CLI default is default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It must be named lwc for -Type lwc and aura for -Type aura, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning component`

#### Examples

```powershell
PS> New-SalesforceLightningComponent -Name accountCard -Type lwc -OutputDirectory force-app/main/default/lwc
```

Generate a Lightning web component.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningComponent -Examples"
- For more information, type: "Get-Help New-SalesforceLightningComponent -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningComponent -Full"
- For online help, type: "Get-Help New-SalesforceLightningComponent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningEvent

#### Synopsis

Creates the files of a new Aura Lightning event in the project.

#### Syntax

```powershell
New-SalesforceLightningEvent [-Name] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning event. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Lightning event already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Lightning event. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Template` (String): Template to use. Valid value: DefaultLightningEvt, which is also the CLI default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It must be a folder named aura, such as force-app/main/default/aura, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning event`

#### Examples

```powershell
PS> New-SalesforceLightningEvent -Name MyEvent -OutputDirectory force-app/main/default/aura
```

Generate the Lightning event.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningEvent -Examples"
- For more information, type: "Get-Help New-SalesforceLightningEvent -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningEvent -Full"
- For online help, type: "Get-Help New-SalesforceLightningEvent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningInterface

#### Synopsis

Creates the files of a new Aura Lightning interface in the project.

#### Syntax

```powershell
New-SalesforceLightningInterface [-Name] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning interface. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Lightning interface already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Lightning interface. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Template` (String): Template to use. Valid value: DefaultLightningIntf, which is also the CLI default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It must be a folder named aura, such as force-app/main/default/aura, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning interface`

#### Examples

```powershell
PS> New-SalesforceLightningInterface -Name MyInterface -OutputDirectory force-app/main/default/aura
```

Generate the Lightning interface.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningInterface -Examples"
- For more information, type: "Get-Help New-SalesforceLightningInterface -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningInterface -Full"
- For online help, type: "Get-Help New-SalesforceLightningInterface -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningOutApp

#### Synopsis

Creates the metadata of a Lightning Out 2.0 app, with its External Client App.

#### Syntax

```powershell
New-SalesforceLightningOutApp [[-AppName] <String>] [[-Components] <String[]>] [[-DefinitionFile] <String>] [[-EcaName] <String>] [[-EcaContactEmail] <String>] [[-EcaCallbackUrl] <String>] [[-HostDomains] <String[]>] [[-Runtime] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning-out, which scaffolds the files for a Lightning Out 2.0 app that puts Lightning web components in an outside web page. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. The CLI needs the External Client App name, contact email and callback URL, the runtime and the host domains. Give them as parameters, or in a -DefinitionFile JSON file; a parameter replaces the same value in the file. Without a file all of them are needed, and the cmdlet says which are missing before it runs sf.

#### Parameters

- `-AppName` (String): Developer name of the new Lightning Out 2.0 app. Passed to sf as --app-name.
- `-Components` (String[]): Components the app exposes, written as namespace/myComponent for a Lightning web component (c/myComponent for your own) or namespace:Name for an Aura component. Each is passed to sf as its own --components. They replace, not merge with, the components in the definition file. Passed to sf as --components.
- `-DefinitionFile` (String): Path of a JSON file that describes the app. It must exist. Parameters replace the matching values in it. Passed to sf as --definition-file.
- `-EcaName` (String): Developer name of the External Client App of the app. Passed to sf as --eca-name.
- `-EcaContactEmail` (String): Contact email of the External Client App. Passed to sf as --eca-contact-email.
- `-EcaCallbackUrl` (String): OAuth callback URL of the External Client App. It must be an absolute https:// URL. Passed to sf as --eca-callback-url.
- `-HostDomains` (String[]): HTTP or HTTPS origins of the outside pages that embed the app. Each is passed to sf as its own --host-domains. They replace, not merge with, the host domains in the definition file. Passed to sf as --host-domains.
- `-Runtime` (String): Runtime that serves the app. Valid values: LWR_CORE, CLWR. Passed to sf as --runtime.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning-out`

#### Examples

```powershell
PS> New-SalesforceLightningOutApp -AppName StoreWidget -Components storeCart -EcaName StoreWidgetEca -EcaContactEmail dev@example.com -EcaCallbackUrl https://shop.example.com/callback -HostDomains https://shop.example.com -Runtime LWR_CORE -OutputDirectory force-app/main/default
```

Generate the app with every required value given.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningOutApp -Examples"
- For more information, type: "Get-Help New-SalesforceLightningOutApp -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningOutApp -Full"
- For online help, type: "Get-Help New-SalesforceLightningOutApp -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceLightningTest

#### Synopsis

Creates the static resource of a new Lightning test in the project.

#### Syntax

```powershell
New-SalesforceLightningTest [-Name] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate lightning test. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Lightning test already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Lightning test. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Template` (String): Template to use. Valid value: DefaultLightningTest, which is also the CLI default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate lightning test`

#### Examples

```powershell
PS> New-SalesforceLightningTest -Name MyTest -OutputDirectory force-app/main/default/staticresources
```

Generate the Lightning test.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceLightningTest -Examples"
- For more information, type: "Get-Help New-SalesforceLightningTest -Detailed"
- For technical information, type: "Get-Help New-SalesforceLightningTest -Full"
- For online help, type: "Get-Help New-SalesforceLightningTest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceStaticResource

#### Synopsis

Creates the files of a new static resource in the project.

#### Syntax

```powershell
New-SalesforceStaticResource [-Name] <String> [[-Type] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate static-resource. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. It writes the metadata file and an empty folder for the content. If the static resource already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the static resource. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Type` (String): Content (MIME) type of the static resource. The CLI default is application/zip. Passed to sf as --type.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate static-resource`

#### Examples

```powershell
PS> New-SalesforceStaticResource -Name Logos -Type application/zip -OutputDirectory force-app/main/default/staticresources
```

Generate a zip static resource.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceStaticResource -Examples"
- For more information, type: "Get-Help New-SalesforceStaticResource -Detailed"
- For technical information, type: "Get-Help New-SalesforceStaticResource -Full"
- For online help, type: "Get-Help New-SalesforceStaticResource -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceUiBundle

#### Synopsis

Creates a UI bundle: the code and metadata of a React, Angular or Vue experience.

#### Syntax

```powershell
New-SalesforceUiBundle [-Name] <String> [[-Label] <String>] [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate ui-bundle, which writes a bundle for a UI built with a non-native framework such as React or Angular, under a uiBundles folder in the output folder. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the bundle already exists the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the UI bundle. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Label` (String): Label of the UI bundle. By default the CLI uses the name. Passed to sf as --label.
- `-Template` (String): Template to use. Valid values: default, reactbasic, angularbasic, vuebasic. The CLI default is default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate ui-bundle`

#### Examples

```powershell
PS> New-SalesforceUiBundle -Name Storefront -Label Storefront -Template reactbasic -OutputDirectory force-app/main/default
```

Generate a React bundle.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceUiBundle -Examples"
- For more information, type: "Get-Help New-SalesforceUiBundle -Detailed"
- For technical information, type: "Get-Help New-SalesforceUiBundle -Full"
- For online help, type: "Get-Help New-SalesforceUiBundle -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceUiEmbedding

#### Synopsis

Creates a Lightning web component that embeds a web page with lightning-ui-embedding.

#### Syntax

```powershell
New-SalesforceUiEmbedding [-Name] <String> [-Src] <String> [-Title] <String> [-Sandbox] <String[]> [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate ui-embedding, which writes a Lightning web component that wraps the lightning-ui-embedding base component and shows -Src in a sandboxed frame. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. The output folder must be named lwc. If the component already exists the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the component. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Src` (String, required): URL of the page to embed. It must be an absolute https:// URL. Passed to sf as --src. Required.
- `-Title` (String, required): Title of the embedded frame. Passed to sf as --title. Required.
- `-Sandbox` (String[], required): What the embedded page may do: one or more sandbox permissions. Each is passed to sf as its own --sandbox. Valid values: allow-forms, allow-modals, allow-orientation-lock, allow-pointer-lock, allow-popups, allow-popups-to-escape-sandbox, allow-presentation, allow-same-origin, allow-scripts, allow-storage-access-by-user-activation, allow-top-navigation, allow-top-navigation-by-user-activation. Passed to sf as --sandbox. Required.
- `-OutputDirectory` (String): Folder to save the created files in. It must be a folder named lwc, such as force-app/main/default/lwc, or the CLI refuses. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate ui-embedding`

#### Examples

```powershell
PS> New-SalesforceUiEmbedding -Name statusPage -Src https://status.example.com -Title 'Status' -Sandbox allow-scripts, allow-forms -OutputDirectory force-app/main/default/lwc
```

Embed a status page.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceUiEmbedding -Examples"
- For more information, type: "Get-Help New-SalesforceUiEmbedding -Detailed"
- For technical information, type: "Get-Help New-SalesforceUiEmbedding -Full"
- For online help, type: "Get-Help New-SalesforceUiEmbedding -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceVisualforceComponent

#### Synopsis

Creates the files of a new Visualforce component in the project.

#### Syntax

```powershell
New-SalesforceVisualforceComponent [-Name] <String> [-Label] <String> [[-Template] <String>] [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate visualforce component. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Visualforce component already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Visualforce component. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Label` (String, required): Label of the Visualforce item, as shown in Setup. Passed to sf as --label. Required.
- `-Template` (String): Template to use. Valid value: DefaultVFComponent, which is also the CLI default. Passed to sf as --template.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate visualforce component`

#### Examples

```powershell
PS> New-SalesforceVisualforceComponent -Name MyComponent -Label 'My Component' -OutputDirectory force-app/main/default/components
```

Generate the Visualforce component.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceVisualforceComponent -Examples"
- For more information, type: "Get-Help New-SalesforceVisualforceComponent -Detailed"
- For technical information, type: "Get-Help New-SalesforceVisualforceComponent -Full"
- For online help, type: "Get-Help New-SalesforceVisualforceComponent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceVisualforcePage

#### Synopsis

Creates the files of a new Visualforce page in the project.

#### Syntax

```powershell
New-SalesforceVisualforcePage [-Name] <String> [-Label] <String> [[-OutputDirectory] <String>] [-Force] [<CommonParameters>]
```

#### Description

Runs sf template generate visualforce page. It writes local files and needs no org; run it inside a Salesforce DX project. It returns the CLI result: outputDir, created (the files it wrote) and rawOutput. If the Visualforce page already exists in the output folder the cmdlet stops, unless you pass -Force.

#### Parameters

- `-Name` (String, required): Name of the Visualforce page. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Label` (String, required): Label of the Visualforce item, as shown in Setup. Passed to sf as --label. Required.
- `-OutputDirectory` (String): Folder to save the created files in. It is created if it does not exist. The CLI default is the current folder. Passed to sf as --output-dir.
- `-Force` (switch): Generate even if the files already exist. Without it the cmdlet stops when the target is already there, because the CLI replaces any file that differs from the template without asking, and your changes in it would be lost. This switch is not a CLI flag.

#### Salesforce CLI

- `sf template generate visualforce page`

#### Examples

```powershell
PS> New-SalesforceVisualforcePage -Name MyPage -Label 'My Page' -OutputDirectory force-app/main/default/pages
```

Generate the Visualforce page.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceVisualforcePage -Examples"
- For more information, type: "Get-Help New-SalesforceVisualforcePage -Detailed"
- For technical information, type: "Get-Help New-SalesforceVisualforcePage -Full"
- For online help, type: "Get-Help New-SalesforceVisualforcePage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-templates>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-devops command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-devops/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

31 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Pipelines and stages**: [Add-SalesforceDevOpsPipelineProject](#add-salesforcedevopspipelineproject), [Add-SalesforceDevOpsPipelineStage](#add-salesforcedevopspipelinestage), [Add-SalesforceDevOpsStageBranch](#add-salesforcedevopsstagebranch), [Add-SalesforceDevOpsStageEnvironment](#add-salesforcedevopsstageenvironment), [Get-SalesforceDevOpsPipeline](#get-salesforcedevopspipeline), [Get-SalesforceDevOpsPipelineDetails](#get-salesforcedevopspipelinedetails), [New-SalesforceDevOpsPipeline](#new-salesforcedevopspipeline), [Remove-SalesforceDevOpsPipelineProject](#remove-salesforcedevopspipelineproject), [Remove-SalesforceDevOpsPipelineStage](#remove-salesforcedevopspipelinestage), [Remove-SalesforceDevOpsStageBranch](#remove-salesforcedevopsstagebranch), [Remove-SalesforceDevOpsStageEnvironment](#remove-salesforcedevopsstageenvironment), [Update-SalesforceDevOpsPipeline](#update-salesforcedevopspipeline), [Update-SalesforceDevOpsPipelineStage](#update-salesforcedevopspipelinestage)

**Promotions and request status**: [Complete-SalesforceDevOpsPromotion](#complete-salesforcedevopspromotion), [Get-SalesforceDevOpsRequestStatus](#get-salesforcedevopsrequeststatus), [Start-SalesforceDevOpsPromotion](#start-salesforcedevopspromotion), [Test-SalesforceDevOpsPromotion](#test-salesforcedevopspromotion)

**Projects**: [Get-SalesforceDevOpsProject](#get-salesforcedevopsproject), [New-SalesforceDevOpsProject](#new-salesforcedevopsproject), [Update-SalesforceDevOpsProject](#update-salesforcedevopsproject)

**Work items and reviews**: [Get-SalesforceDevOpsWorkItem](#get-salesforcedevopsworkitem), [Initialize-SalesforceDevOpsWorkItem](#initialize-salesforcedevopsworkitem), [Join-SalesforceDevOpsWorkItem](#join-salesforcedevopsworkitem), [New-SalesforceDevOpsReview](#new-salesforcedevopsreview), [New-SalesforceDevOpsWorkItem](#new-salesforcedevopsworkitem), [Update-SalesforceDevOpsWorkItem](#update-salesforcedevopsworkitem)

**Pipeline deployments**: [Get-SalesforcePipelineDeployStatus](#get-salesforcepipelinedeploystatus), [Resume-SalesforcePipelineDeploy](#resume-salesforcepipelinedeploy), [Start-SalesforcePipelineDeploy](#start-salesforcepipelinedeploy), [Start-SalesforcePipelineQuickDeploy](#start-salesforcepipelinequickdeploy), [Test-SalesforcePipelineDeploy](#test-salesforcepipelinedeploy)

## Pipelines and stages

### Add-SalesforceDevOpsPipelineProject

#### Synopsis

Attaches a project to a DevOps Center pipeline.

#### Syntax

```powershell
Add-SalesforceDevOpsPipelineProject [-PipelineId] <String> [-ProjectId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline project add. Connects the project to the pipeline. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline. Passed to sf as --pipeline-id. Required.
- `-ProjectId` (String, required): ID of the project to attach. Passed to sf as --project-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline project add`

#### Examples

```powershell
PS> Add-SalesforceDevOpsPipelineProject -PipelineId 0XB000000000001 -ProjectId 0Hn000000000001 -TargetOrg devops-org -WhatIf
```

Preview attaching a project.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceDevOpsPipelineProject -Examples"
- For more information, type: "Get-Help Add-SalesforceDevOpsPipelineProject -Detailed"
- For technical information, type: "Get-Help Add-SalesforceDevOpsPipelineProject -Full"
- For online help, type: "Get-Help Add-SalesforceDevOpsPipelineProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Add-SalesforceDevOpsPipelineStage

#### Synopsis

Adds a stage to a DevOps Center pipeline.

#### Syntax

```powershell
Add-SalesforceDevOpsPipelineStage [-PipelineId] <String> [-Name] <String> [-NextStageId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline stage add. Inserts an empty stage before the stage given as -NextStageId. The new stage has no branch or environment: add them with Add-SalesforceDevOpsStageBranch and Add-SalesforceDevOpsStageEnvironment. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline. Passed to sf as --pipeline-id. Required.
- `-Name` (String, required): Name of the stage, such as Integration, UAT or Staging. Passed to sf as --name. Required.
- `-NextStageId` (String, required): ID of the stage that follows the new stage. Passed to sf as --next-stage-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline stage add`

#### Examples

```powershell
PS> Add-SalesforceDevOpsPipelineStage -PipelineId 0XB000000000001 -Name QA -NextStageId 1QV000000000002 -TargetOrg devops-org -WhatIf
```

Preview adding a QA stage.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceDevOpsPipelineStage -Examples"
- For more information, type: "Get-Help Add-SalesforceDevOpsPipelineStage -Detailed"
- For technical information, type: "Get-Help Add-SalesforceDevOpsPipelineStage -Full"
- For online help, type: "Get-Help Add-SalesforceDevOpsPipelineStage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Add-SalesforceDevOpsStageBranch

#### Synopsis

Assigns a repository branch to a pipeline stage.

#### Syntax

```powershell
Add-SalesforceDevOpsStageBranch [-PipelineId] <String> [-StageId] <String> [-BranchName] <String> [-CreateVcsBranch] [-Force] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops stage branch add. By default the branch must already exist in the repository; -CreateVcsBranch creates it. A stage has one branch. If it already has one the command stops so the old branch is not orphaned, unless you give -Force, which replaces it. Branches are set from right to left: a stage can have a branch only after the stage to its right has one. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline that holds the stage. Passed to sf as --pipeline-id. Required.
- `-StageId` (String, required): ID of the stage. Passed to sf as --stage-id. Required.
- `-BranchName` (String, required): Name of the repository branch. Passed to sf as --branch-name. Required.
- `-CreateVcsBranch` (switch): Create the branch in the remote repository if it does not exist. Adds --create-vcs-branch.
- `-Force` (switch): Replace the stage's existing branch. Adds --force.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops stage branch add`

#### Examples

```powershell
PS> Add-SalesforceDevOpsStageBranch -PipelineId 0XB000000000001 -StageId 1QV000000000002 -BranchName uat -CreateVcsBranch -TargetOrg devops-org -WhatIf
```

Preview assigning a branch, creating it if needed.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceDevOpsStageBranch -Examples"
- For more information, type: "Get-Help Add-SalesforceDevOpsStageBranch -Detailed"
- For technical information, type: "Get-Help Add-SalesforceDevOpsStageBranch -Full"
- For online help, type: "Get-Help Add-SalesforceDevOpsStageBranch -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Add-SalesforceDevOpsStageEnvironment

#### Synopsis

Adds a Salesforce environment to a pipeline stage.

#### Syntax

```powershell
Add-SalesforceDevOpsStageEnvironment [-PipelineId] <String> [-StageId] <String> [-EnvironmentName] <String> [-OrgType] <String> [-NoBrowser] [-Force] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops stage environment add. Starts an OAuth login to connect the environment, which opens a browser window (-NoBrowser prints the URL instead) and waits until you finish. A stage has one environment. If it already has one the command stops unless you give -Force, which adds the new one first and removes the old one after the new one is connected. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline that holds the stage. Passed to sf as --pipeline-id. Required.
- `-StageId` (String, required): ID of the stage. Passed to sf as --stage-id. Required.
- `-EnvironmentName` (String, required): Name of the environment. Passed to sf as --environment-name. Required.
- `-OrgType` (String, required): Type of the Salesforce org. Valid values: Production, Sandbox. Passed to sf as --org-type. Required.
- `-NoBrowser` (switch): Do not open the browser for the login; the CLI prints the URL for you to open yourself. The CLI only prints it outside JSON mode, so with this switch the command runs live in your terminal without --json (it needs a terminal, and returns nothing). Adds --no-browser.
- `-Force` (switch): Replace the stage's existing environment. Adds --force.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops stage environment add`

#### Examples

```powershell
PS> Add-SalesforceDevOpsStageEnvironment -PipelineId 0XB000000000001 -StageId 1QV000000000002 -EnvironmentName uat-sandbox -OrgType Sandbox -TargetOrg devops-org -WhatIf
```

Preview connecting a sandbox to a stage.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforceDevOpsStageEnvironment -Examples"
- For more information, type: "Get-Help Add-SalesforceDevOpsStageEnvironment -Detailed"
- For technical information, type: "Get-Help Add-SalesforceDevOpsStageEnvironment -Full"
- For online help, type: "Get-Help Add-SalesforceDevOpsStageEnvironment -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDevOpsPipeline

#### Synopsis

Lists the DevOps Center pipelines.

#### Syntax

```powershell
Get-SalesforceDevOpsPipeline [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline list. Returns every pipeline with its stages, repositories and connected projects. For one pipeline in detail use Get-SalesforceDevOpsPipelineDetails. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-TargetOrg` (String): 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 devops pipeline list`

#### Examples

```powershell
PS> Get-SalesforceDevOpsPipeline -TargetOrg devops-org
```

All pipelines.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDevOpsPipeline -Examples"
- For more information, type: "Get-Help Get-SalesforceDevOpsPipeline -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDevOpsPipeline -Full"
- For online help, type: "Get-Help Get-SalesforceDevOpsPipeline -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDevOpsPipelineDetails

#### Synopsis

Shows one DevOps Center pipeline in detail.

#### Syntax

```powershell
Get-SalesforceDevOpsPipelineDetails [-PipelineId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline get. Returns one pipeline: its stages in order, the repository and branch of each stage, and its connected projects. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline, from Get-SalesforceDevOpsPipeline. Passed to sf as --pipeline-id. Required.
- `-TargetOrg` (String): 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 devops pipeline get`

#### Examples

```powershell
PS> Get-SalesforceDevOpsPipelineDetails -PipelineId 0XB000000000001 -TargetOrg devops-org
```

One pipeline in detail.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDevOpsPipelineDetails -Examples"
- For more information, type: "Get-Help Get-SalesforceDevOpsPipelineDetails -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDevOpsPipelineDetails -Full"
- For online help, type: "Get-Help Get-SalesforceDevOpsPipelineDetails -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceDevOpsPipeline

#### Synopsis

Creates a DevOps Center pipeline attached to a repository.

#### Syntax

```powershell
New-SalesforceDevOpsPipeline [-Name] <String> [-Repo] <String> [[-Stage] <String[]>] [[-ProjectId] <String[]>] [-CreateRepo] [[-RepoType] <String>] [[-RepoOwner] <String>] [[-BitbucketWorkspace] <String>] [[-BitbucketProjectKey] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline create. Give the URL of an existing repository as -Repo, or use -CreateRepo with a repository name to create one on GitHub or Bitbucket. After you create the pipeline, add stages (unless you gave -Stage) and activate it with Update-SalesforceDevOpsPipeline -Activate. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-Name` (String, required): Name of the pipeline. Passed to sf as --name. Required.
- `-Repo` (String, required): URL of an existing repository, or the name of a repository to create with -CreateRepo. Passed to sf as --repo. Required.
- `-Stage` (String[]): Names of the pipeline stages in promotion order. Each is passed to sf as its own --stage. The CLI default is Integration, UAT, Staging and Production. Passed to sf as --stage.
- `-ProjectId` (String[]): IDs of projects to associate with the pipeline. Each is passed to sf as its own --project-id. Passed to sf as --project-id.
- `-CreateRepo` (switch): Create the repository if it does not exist. Needs -RepoType, and -RepoOwner for GitHub or -BitbucketWorkspace for Bitbucket. Adds --create-repo.
- `-RepoType` (String): Type of the repository. Valid values: github, bitbucket. Needed with -CreateRepo. Passed to sf as --repo-type.
- `-RepoOwner` (String): Owner (organization or user) of the GitHub repository. Needed to create a GitHub repository. Passed to sf as --repo-owner.
- `-BitbucketWorkspace` (String): Bitbucket workspace that will own the repository. Needed to create a Bitbucket repository. Passed to sf as --bitbucket-workspace.
- `-BitbucketProjectKey` (String): Bitbucket project key to associate with the repository. Optional when creating a Bitbucket repository. Passed to sf as --bitbucket-project-key.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline create`

#### Examples

```powershell
PS> New-SalesforceDevOpsPipeline -Name 'Release Pipeline' -Repo https://github.com/myorg/myrepo -TargetOrg devops-org -WhatIf
```

Preview creating a pipeline on an existing repository.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceDevOpsPipeline -Examples"
- For more information, type: "Get-Help New-SalesforceDevOpsPipeline -Detailed"
- For technical information, type: "Get-Help New-SalesforceDevOpsPipeline -Full"
- For online help, type: "Get-Help New-SalesforceDevOpsPipeline -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceDevOpsPipelineProject

#### Synopsis

Disconnects a project from a DevOps Center pipeline.

#### Syntax

```powershell
Remove-SalesforceDevOpsPipelineProject [-PipelineId] <String> [-ProjectId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline project delete. Removes the connection between the project and the pipeline. The project itself is not deleted. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline. Passed to sf as --pipeline-id. Required.
- `-ProjectId` (String, required): ID of the project to disconnect. Passed to sf as --project-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline project delete`

#### Examples

```powershell
PS> Remove-SalesforceDevOpsPipelineProject -PipelineId 0XB000000000001 -ProjectId 0Hn000000000001 -TargetOrg devops-org -WhatIf
```

Preview disconnecting a project.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceDevOpsPipelineProject -Examples"
- For more information, type: "Get-Help Remove-SalesforceDevOpsPipelineProject -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceDevOpsPipelineProject -Full"
- For online help, type: "Get-Help Remove-SalesforceDevOpsPipelineProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceDevOpsPipelineStage

#### Synopsis

Deletes a stage from a DevOps Center pipeline.

#### Syntax

```powershell
Remove-SalesforceDevOpsPipelineStage [-PipelineId] <String> [-StageId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline stage delete. If the stage sits between two others, the stage before it is linked to the stage after it, so the chain stays whole. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline that holds the stage. Passed to sf as --pipeline-id. Required.
- `-StageId` (String, required): ID of the stage to delete. Passed to sf as --stage-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline stage delete`

#### Examples

```powershell
PS> Remove-SalesforceDevOpsPipelineStage -PipelineId 0XB000000000001 -StageId 1QV000000000002 -TargetOrg devops-org -WhatIf
```

Preview deleting a stage.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceDevOpsPipelineStage -Examples"
- For more information, type: "Get-Help Remove-SalesforceDevOpsPipelineStage -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceDevOpsPipelineStage -Full"
- For online help, type: "Get-Help Remove-SalesforceDevOpsPipelineStage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceDevOpsStageBranch

#### Synopsis

Removes the branch of a pipeline stage from the stage.

#### Syntax

```powershell
Remove-SalesforceDevOpsStageBranch [-PipelineId] <String> [-StageId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops stage branch delete. Only the link between the stage and its branch is removed; the branch in the repository stays. Branches are set from right to left, so this also removes the branches of every stage before it (to its left). The pipeline must be inactive. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline that holds the stage. The CLI uses it to check that the pipeline is inactive. Passed to sf as --pipeline-id. Required.
- `-StageId` (String, required): ID of the stage whose branch to remove. Passed to sf as --stage-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops stage branch delete`

#### Examples

```powershell
PS> Remove-SalesforceDevOpsStageBranch -PipelineId 0XB000000000001 -StageId 1QV000000000002 -TargetOrg devops-org -WhatIf
```

Preview removing a stage's branch.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceDevOpsStageBranch -Examples"
- For more information, type: "Get-Help Remove-SalesforceDevOpsStageBranch -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceDevOpsStageBranch -Full"
- For online help, type: "Get-Help Remove-SalesforceDevOpsStageBranch -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceDevOpsStageEnvironment

#### Synopsis

Removes an environment from a pipeline stage.

#### Syntax

```powershell
Remove-SalesforceDevOpsStageEnvironment [-PipelineId] <String> [-EnvironmentId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops stage environment delete. The pipeline must be inactive. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline. The CLI uses it to check that the pipeline is inactive. Passed to sf as --pipeline-id. Required.
- `-EnvironmentId` (String, required): ID of the environment to remove. Passed to sf as --environment-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops stage environment delete`

#### Examples

```powershell
PS> Remove-SalesforceDevOpsStageEnvironment -PipelineId 0XB000000000001 -EnvironmentId 0Xx000000000001 -TargetOrg devops-org -WhatIf
```

Preview removing an environment.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceDevOpsStageEnvironment -Examples"
- For more information, type: "Get-Help Remove-SalesforceDevOpsStageEnvironment -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceDevOpsStageEnvironment -Full"
- For online help, type: "Get-Help Remove-SalesforceDevOpsStageEnvironment -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceDevOpsPipeline

#### Synopsis

Renames, activates or deactivates a DevOps Center pipeline.

#### Syntax

```powershell
Update-SalesforceDevOpsPipeline [-PipelineId] <String> [[-Name] <String>] [-Activate] [-Deactivate] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline update. Give at least one of -Name, -Activate and -Deactivate. A pipeline needs at least one stage before you can activate it, and you cannot change its stages after you activate it and promote changes through it, so -Activate asks for confirmation. You can combine -Deactivate and -Name. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-PipelineId` (String, required): ID of the pipeline. Passed to sf as --pipeline-id. Required.
- `-Name` (String): New name of the pipeline. Passed to sf as --name.
- `-Activate` (switch): Activate the pipeline. Cannot be used with -Deactivate. Asks for confirmation by default. Adds --activate.
- `-Deactivate` (switch): Deactivate the pipeline. Cannot be used with -Activate. Adds --deactivate.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline update`

#### Examples

```powershell
PS> Update-SalesforceDevOpsPipeline -PipelineId 0XB000000000001 -Activate -TargetOrg devops-org -WhatIf
```

Preview activating a pipeline.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceDevOpsPipeline -Examples"
- For more information, type: "Get-Help Update-SalesforceDevOpsPipeline -Detailed"
- For technical information, type: "Get-Help Update-SalesforceDevOpsPipeline -Full"
- For online help, type: "Get-Help Update-SalesforceDevOpsPipeline -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceDevOpsPipelineStage

#### Synopsis

Renames a stage of a DevOps Center pipeline.

#### Syntax

```powershell
Update-SalesforceDevOpsPipelineStage [-StageId] <String> [-Name] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops pipeline stage update. Changes the name of the stage. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-StageId` (String, required): ID of the stage. Passed to sf as --stage-id. Required.
- `-Name` (String, required): New name of the stage. Passed to sf as --name. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops pipeline stage update`

#### Examples

```powershell
PS> Update-SalesforceDevOpsPipelineStage -StageId 1QV000000000002 -Name Staging -TargetOrg devops-org -WhatIf
```

Preview renaming a stage.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceDevOpsPipelineStage -Examples"
- For more information, type: "Get-Help Update-SalesforceDevOpsPipelineStage -Detailed"
- For technical information, type: "Get-Help Update-SalesforceDevOpsPipelineStage -Full"
- For online help, type: "Get-Help Update-SalesforceDevOpsPipelineStage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Promotions and request status

### Complete-SalesforceDevOpsPromotion

#### Synopsis

Deploys work items that were merged outside DevOps Center to a stage.

#### Syntax

```powershell
Complete-SalesforceDevOpsPromotion [-TargetStageId] <String> [[-WorkItemId] <String[]>] [-DeployAll] [[-TestLevel] <String>] [[-Tests] <String[]>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops promotion complete. Deploys work items that were merged into the pipeline branch outside DevOps Center (externally merged) into the target stage's org and updates the DevOps Center records. It is the "Complete Promotion" action of the DevOps Center page for a stage that is out of sync. Without -WorkItemId it deploys every undeployed work item of the stage; if there are none it does nothing and succeeds. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-TargetStageId` (String, required): ID of the out-of-sync stage to deploy to. Passed to sf as --target-stage-id. Required.
- `-WorkItemId` (String[]): IDs of specific work items to deploy. Each is passed to sf as its own --work-item-id. Leave it out to deploy all the undeployed work items of the stage; use it for the first stage of a pipeline, which has no source stage. Passed to sf as --work-item-id.
- `-DeployAll` (switch): Deploy all the metadata in the branch, not only the changes that are not yet in the stage. Adds --deploy-all.
- `-TestLevel` (String): Optional. Apex test level of the deployment. Valid values: NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg. NoTestRun is only for development orgs. Passed to sf as --test-level. The CLI default applies when omitted.
- `-Tests` (String[]): Apex tests to run with -TestLevel RunSpecifiedTests. Passed as one --tests per test.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops promotion complete`

#### Examples

```powershell
PS> Complete-SalesforceDevOpsPromotion -TargetStageId 1QV000000000002 -TargetOrg devops-org -WhatIf
```

Preview completing the promotion of a stage.

#### Remarks

- To see the examples, type: "Get-Help Complete-SalesforceDevOpsPromotion -Examples"
- For more information, type: "Get-Help Complete-SalesforceDevOpsPromotion -Detailed"
- For technical information, type: "Get-Help Complete-SalesforceDevOpsPromotion -Full"
- For online help, type: "Get-Help Complete-SalesforceDevOpsPromotion -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDevOpsRequestStatus

#### Synopsis

Gets the status of a DevOps Center request.

#### Syntax

```powershell
Get-SalesforceDevOpsRequestStatus [-RequestToken] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops request status. Returns the current status of the request with the given token, such as the one Start-SalesforceDevOpsPromotion returns. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-RequestToken` (String, required): The request token from the promotion result. Passed to sf as --request-token. Required.
- `-TargetOrg` (String): 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 devops request status`

#### Examples

```powershell
PS> Get-SalesforceDevOpsRequestStatus -RequestToken $promotion.requestToken -TargetOrg devops-org
```

Check on a promotion.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDevOpsRequestStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceDevOpsRequestStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDevOpsRequestStatus -Full"
- For online help, type: "Get-Help Get-SalesforceDevOpsRequestStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceDevOpsPromotion

#### Synopsis

Promotes work items, or a whole stage, to a pipeline stage.

#### Syntax

```powershell
Start-SalesforceDevOpsPromotion [-TargetStageId] <String> [[-WorkItemId] <String[]>] [[-StageId] <String>] [-DeployAll] [-Force] [-SkipValidation] [[-TestLevel] <String>] [[-Tests] <String[]>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops promote. Give -WorkItemId to promote specific work items, or -StageId to promote all the approved work items of a source stage; exactly one of the two. It deploys to the org of the target stage. By default it stops if another promotion to the same stage is running (-Force overrides) and it checks first that each work item has a pull request (-SkipValidation skips that). It returns a request token that Get-SalesforceDevOpsRequestStatus takes. Asks for confirmation (use -Confirm:$false in a script) and supports -WhatIf. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-TargetStageId` (String, required): ID of the pipeline stage to promote to. Passed to sf as --target-stage-id. Required.
- `-WorkItemId` (String[]): IDs of the work items to promote. Each is passed to sf as its own --work-item-id. Use it or -StageId. Passed to sf as --work-item-id.
- `-StageId` (String): ID of the source stage whose approved work items are promoted. Use it or -WorkItemId. Passed to sf as --stage-id.
- `-DeployAll` (switch): Deploy all the metadata in the branch, not only the changes that are not yet in the target stage. Adds --deploy-all.
- `-Force` (switch): Submit the promotion even if another promotion to the same target stage is in progress. Adds --force.
- `-SkipValidation` (switch): Skip the check before the promotion that each work item has a pull request. Adds --skip-validation.
- `-TestLevel` (String): Optional. Apex test level of the deployment. Valid values: NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg. NoTestRun is only for development orgs. Passed to sf as --test-level. The CLI default applies when omitted.
- `-Tests` (String[]): Apex tests to run with -TestLevel RunSpecifiedTests. Passed as one --tests per test.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops promote`

#### Examples

```powershell
PS> Start-SalesforceDevOpsPromotion -StageId 1QV000000000001 -TargetStageId 1QV000000000002 -TargetOrg devops-org -WhatIf
```

Preview promoting a whole stage.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceDevOpsPromotion -Examples"
- For more information, type: "Get-Help Start-SalesforceDevOpsPromotion -Detailed"
- For technical information, type: "Get-Help Start-SalesforceDevOpsPromotion -Full"
- For online help, type: "Get-Help Start-SalesforceDevOpsPromotion -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceDevOpsPromotion

#### Synopsis

Checks whether work items can be promoted to a stage.

#### Syntax

```powershell
Test-SalesforceDevOpsPromotion [-TargetStageId] <String> [-WorkItemId] <String[]> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops promotion validate. Validates the work items for the target stage: it looks for version control and object permission errors before a promotion is tried. It does not deploy anything. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-TargetStageId` (String, required): ID of the stage to validate the promotion to. Passed to sf as --target-stage-id. Required.
- `-WorkItemId` (String[], required): IDs of the work items to validate. Each is passed to sf as its own --work-item-id. Passed to sf as --work-item-id. Required.
- `-TargetOrg` (String): 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 devops promotion validate`

#### Examples

```powershell
PS> Test-SalesforceDevOpsPromotion -WorkItemId 1fk000000000001 -TargetStageId 1QV000000000002 -TargetOrg devops-org
PS> Can this work item be promoted?
```

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceDevOpsPromotion -Examples"
- For more information, type: "Get-Help Test-SalesforceDevOpsPromotion -Detailed"
- For technical information, type: "Get-Help Test-SalesforceDevOpsPromotion -Full"
- For online help, type: "Get-Help Test-SalesforceDevOpsPromotion -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Projects

### Get-SalesforceDevOpsProject

#### Synopsis

Lists the DevOps Center projects of an org.

#### Syntax

```powershell
Get-SalesforceDevOpsProject [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops project list. Returns the DevOps Center projects with their IDs, which the work item, pipeline and promotion cmdlets take. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-TargetOrg` (String): 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 devops project list`

#### Examples

```powershell
PS> Get-SalesforceDevOpsProject -TargetOrg devops-org
```

List the projects.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDevOpsProject -Examples"
- For more information, type: "Get-Help Get-SalesforceDevOpsProject -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDevOpsProject -Full"
- For online help, type: "Get-Help Get-SalesforceDevOpsProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceDevOpsProject

#### Synopsis

Creates a DevOps Center project.

#### Syntax

```powershell
New-SalesforceDevOpsProject [-Name] <String> [[-Description] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops project create. Creates a project with a name and an optional description in the DevOps Center org. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-Name` (String, required): Name of the project. Passed to sf as --name. Required.
- `-Description` (String): Description of the project. Passed to sf as --description.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops project create`

#### Examples

```powershell
PS> New-SalesforceDevOpsProject -Name 'Sales App' -Description 'Quarterly releases' -TargetOrg devops-org -WhatIf
```

Preview creating a project.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceDevOpsProject -Examples"
- For more information, type: "Get-Help New-SalesforceDevOpsProject -Detailed"
- For technical information, type: "Get-Help New-SalesforceDevOpsProject -Full"
- For online help, type: "Get-Help New-SalesforceDevOpsProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceDevOpsProject

#### Synopsis

Renames, describes or activates or deactivates a DevOps Center project.

#### Syntax

```powershell
Update-SalesforceDevOpsProject [-ProjectId] <String> [[-Name] <String>] [[-Description] <String>] [-IsActive] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops project update. Give at least one of -Name, -Description and -IsActive. Use -IsActive to activate the project and -IsActive:$false to deactivate it. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-ProjectId` (String, required): ID of the project to update. Passed to sf as --project-id. Required.
- `-Name` (String): New name of the project. Passed to sf as --name.
- `-Description` (String): New description of the project. Passed to sf as --description.
- `-IsActive` (switch): Set whether the project is active. Adds --is-active, or --no-is-active when you write -IsActive:$false. Passed to sf as --is-active.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops project update`

#### Examples

```powershell
PS> Update-SalesforceDevOpsProject -ProjectId 0Hn000000000001 -IsActive:$false -TargetOrg devops-org -WhatIf
```

Preview deactivating a project.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceDevOpsProject -Examples"
- For more information, type: "Get-Help Update-SalesforceDevOpsProject -Detailed"
- For technical information, type: "Get-Help Update-SalesforceDevOpsProject -Full"
- For online help, type: "Get-Help Update-SalesforceDevOpsProject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Work items and reviews

### Get-SalesforceDevOpsWorkItem

#### Synopsis

Lists the work items of a DevOps Center project.

#### Syntax

```powershell
Get-SalesforceDevOpsWorkItem [-ProjectId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf devops work-item list. Each work item shows the branch, environment and repository details needed to check it out and promote it, and its ID, which the promotion cmdlets take. It only reads. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-ProjectId` (String, required): ID of the project, from Get-SalesforceDevOpsProject. Passed to sf as --project-id. Required.
- `-TargetOrg` (String): 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 devops work-item list`

#### Examples

```powershell
PS> Get-SalesforceDevOpsWorkItem -ProjectId 1Qg000000000001 -TargetOrg devops-org
```

The work items of a project.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDevOpsWorkItem -Examples"
- For more information, type: "Get-Help Get-SalesforceDevOpsWorkItem -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDevOpsWorkItem -Full"
- For online help, type: "Get-Help Get-SalesforceDevOpsWorkItem -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Initialize-SalesforceDevOpsWorkItem

#### Synopsis

Prepares a work item for a one-off promotion to a stage.

#### Syntax

```powershell
Initialize-SalesforceDevOpsWorkItem [-WorkItemId] <String> [-TargetStageId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops work-item prepare. Creates the branches and pull requests in the source control repository that a one-off promotion needs. Run it before Start-SalesforceDevOpsPromotion for a one-off promotion. Get the IDs from Get-SalesforceDevOpsWorkItem. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-WorkItemId` (String, required): ID of the work item to prepare. Passed to sf as --work-item-id. Required.
- `-TargetStageId` (String, required): ID of the pipeline stage to promote the work item to. Passed to sf as --target-stage-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops work-item prepare`

#### Examples

```powershell
PS> Initialize-SalesforceDevOpsWorkItem -WorkItemId 1fk000000000001 -TargetStageId 1QV000000000001 -TargetOrg devops-org -WhatIf
```

Preview preparing a work item.

#### Remarks

- To see the examples, type: "Get-Help Initialize-SalesforceDevOpsWorkItem -Examples"
- For more information, type: "Get-Help Initialize-SalesforceDevOpsWorkItem -Detailed"
- For technical information, type: "Get-Help Initialize-SalesforceDevOpsWorkItem -Full"
- For online help, type: "Get-Help Initialize-SalesforceDevOpsWorkItem -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Join-SalesforceDevOpsWorkItem

#### Synopsis

Prepares work items to be combined and promoted together.

#### Syntax

```powershell
Join-SalesforceDevOpsWorkItem [-ParentWorkItemId] <String> [-ChildWorkItemId] <String[]> [-TargetStageId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops work-item combine. Use it when work items in the same stage share metadata or depend on each other: DevOps Center combines the child work items into the parent so they are promoted as one unit. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-ParentWorkItemId` (String, required): ID of the parent work item. Passed to sf as --parent-work-item-id. Required.
- `-ChildWorkItemId` (String[], required): IDs of the work items to combine into the parent. Each is passed to sf as its own --child-work-item-id. Passed to sf as --child-work-item-id. Required.
- `-TargetStageId` (String, required): ID of the pipeline stage to promote the combined work item to. Passed to sf as --target-stage-id. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops work-item combine`

#### Examples

```powershell
PS> Join-SalesforceDevOpsWorkItem -ParentWorkItemId 1fk000000000001 -ChildWorkItemId 1fk000000000002, 1fk000000000003 -TargetStageId 1QV000000000001 -TargetOrg devops-org -WhatIf
```

Preview combining two work items into one.

#### Remarks

- To see the examples, type: "Get-Help Join-SalesforceDevOpsWorkItem -Examples"
- For more information, type: "Get-Help Join-SalesforceDevOpsWorkItem -Detailed"
- For technical information, type: "Get-Help Join-SalesforceDevOpsWorkItem -Full"
- For online help, type: "Get-Help Join-SalesforceDevOpsWorkItem -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceDevOpsReview

#### Synopsis

Creates a pull request for a work item branch.

#### Syntax

```powershell
New-SalesforceDevOpsReview [[-WorkItemId] <String>] [[-WorkItemName] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops review create. Creates the pull request through the DevOps Center API with the version control credentials stored in the org, for GitHub and Bitbucket, so no local login to the repository is needed. Identify the work item by -WorkItemId or -WorkItemName. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-WorkItemId` (String): ID of the work item. Use it or -WorkItemName. Passed to sf as --work-item-id.
- `-WorkItemName` (String): Name of the work item, such as WI-000001. Use it or -WorkItemId. Passed to sf as --work-item-name.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops review create`

#### Examples

```powershell
PS> New-SalesforceDevOpsReview -WorkItemName WI-000001 -TargetOrg devops-org -WhatIf
```

Preview opening a pull request.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceDevOpsReview -Examples"
- For more information, type: "Get-Help New-SalesforceDevOpsReview -Detailed"
- For technical information, type: "Get-Help New-SalesforceDevOpsReview -Full"
- For online help, type: "Get-Help New-SalesforceDevOpsReview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceDevOpsWorkItem

#### Synopsis

Creates a work item in a DevOps Center project.

#### Syntax

```powershell
New-SalesforceDevOpsWorkItem [-ProjectId] <String> [-Subject] <String> [[-Description] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops work-item create. Creates a work item with a subject and an optional description. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-ProjectId` (String, required): ID of the project to create the work item in. Passed to sf as --project-id. Required.
- `-Subject` (String, required): Subject (title) of the work item. Passed to sf as --subject. Required.
- `-Description` (String): Description of the work item. Passed to sf as --description.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops work-item create`

#### Examples

```powershell
PS> New-SalesforceDevOpsWorkItem -ProjectId 1Qg000000000001 -Subject 'Add invoice flow' -TargetOrg devops-org
```

Create a work item.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceDevOpsWorkItem -Examples"
- For more information, type: "Get-Help New-SalesforceDevOpsWorkItem -Detailed"
- For technical information, type: "Get-Help New-SalesforceDevOpsWorkItem -Full"
- For online help, type: "Get-Help New-SalesforceDevOpsWorkItem -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceDevOpsWorkItem

#### Synopsis

Changes the subject, description or status of a work item.

#### Syntax

```powershell
Update-SalesforceDevOpsWorkItem [[-WorkItemId] <String>] [[-WorkItemName] <String>] [[-Subject] <String>] [[-Description] <String>] [[-Status] <String>] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf devops work-item update. Identify the work item by -WorkItemId or by -WorkItemName, and give at least one of -Subject, -Description and -Status. Supports -WhatIf and -Confirm; it does not ask by default. It needs a DevOps Center org that you are logged in to (-TargetOrg, or the target-org configuration) and a user who is allowed to work with DevOps Center; the CLI reports a permission error if not. The command comes from the @salesforce/plugin-devops-center plugin, which the CLI installs the first time it needs it.

#### Parameters

- `-WorkItemId` (String): ID of the work item. Use it or -WorkItemName. Passed to sf as --work-item-id.
- `-WorkItemName` (String): Name of the work item, such as WI-000001. Use it or -WorkItemId. Passed to sf as --work-item-name.
- `-Subject` (String): New subject. Passed to sf as --subject.
- `-Description` (String): New description. Passed to sf as --description.
- `-Status` (String): New status. Valid values: In Progress, Ready to Promote. Passed to sf as --status.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf devops work-item update`

#### Examples

```powershell
PS> Update-SalesforceDevOpsWorkItem -WorkItemName WI-000001 -Status 'Ready to Promote' -TargetOrg devops-org -WhatIf
```

Preview marking a work item ready.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceDevOpsWorkItem -Examples"
- For more information, type: "Get-Help Update-SalesforceDevOpsWorkItem -Detailed"
- For technical information, type: "Get-Help Update-SalesforceDevOpsWorkItem -Full"
- For online help, type: "Get-Help Update-SalesforceDevOpsWorkItem -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Pipeline deployments

### Get-SalesforcePipelineDeployStatus

#### Synopsis

Reports the status of a DevOps Center pipeline deployment (beta).

#### Syntax

```powershell
Get-SalesforcePipelineDeployStatus [-DevOpsCenterUsername] <String> [[-JobId] <String>] [-UseMostRecent] [<CommonParameters>]
```

#### Description

Runs sf project deploy pipeline report, a beta command of the DevOps Center plugin, for a job ID or for the most recent deployment with -UseMostRecent. Read-only. Because the command is beta, its name, flags and result can change in a later CLI release.

#### Parameters

- `-DevOpsCenterUsername` (String, required): Username or alias of the DevOps Center org. Passed as --devops-center-username. Required.
- `-JobId` (String): Job ID of the pipeline deployment. A 15 or 18 character ID. Passed as --job-id.
- `-UseMostRecent` (switch): Report on the deployment the CLI started most recently. Use instead of -JobId. Adds --use-most-recent.

#### Salesforce CLI

- `sf project deploy pipeline report`

#### Examples

```powershell
PS> Get-SalesforcePipelineDeployStatus -DevOpsCenterUsername doc-org -UseMostRecent
```

Status of the last pipeline deployment.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforcePipelineDeployStatus -Examples"
- For more information, type: "Get-Help Get-SalesforcePipelineDeployStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePipelineDeployStatus -Full"
- For online help, type: "Get-Help Get-SalesforcePipelineDeployStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforcePipelineDeploy

#### Synopsis

Resumes watching a DevOps Center pipeline deployment that is still running (beta).

#### Syntax

```powershell
Resume-SalesforcePipelineDeploy [-DevOpsCenterUsername] <String> [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [-ConciseResults] [-DetailedResults] [<CommonParameters>]
```

#### Description

Runs sf project deploy pipeline resume, a beta command of the DevOps Center plugin, for a job ID or for the most recent deployment with -UseMostRecent. Because the command is beta, its name, flags and result can change in a later CLI release.

#### Parameters

- `-DevOpsCenterUsername` (String, required): Username or alias of the DevOps Center org. Passed as --devops-center-username. Required.
- `-JobId` (String): Job ID of the pipeline deployment. A 15 or 18 character ID. Passed as --job-id.
- `-UseMostRecent` (switch): Resume the deployment the CLI started most recently. Use instead of -JobId. Adds --use-most-recent.
- `-Wait` (Int32): Number of minutes to wait for the deployment to finish. Passed as --wait.
- `-ConciseResults` (switch): Show concise output of the result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the result. Adds --verbose.

#### Salesforce CLI

- `sf project deploy pipeline resume`

#### Examples

```powershell
PS> Resume-SalesforcePipelineDeploy -DevOpsCenterUsername doc-org -UseMostRecent -Wait 10
```

Wait up to ten more minutes for the last pipeline deployment.

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforcePipelineDeploy -Examples"
- For more information, type: "Get-Help Resume-SalesforcePipelineDeploy -Detailed"
- For technical information, type: "Get-Help Resume-SalesforcePipelineDeploy -Full"
- For online help, type: "Get-Help Resume-SalesforcePipelineDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforcePipelineDeploy

#### Synopsis

Deploys the changes of a branch to the org of a DevOps Center pipeline stage (beta).

#### Syntax

```powershell
Start-SalesforcePipelineDeploy [-DevOpsCenterUsername] <String> [-DevOpsCenterProjectName] <String> [-BranchName] <String> [[-BundleVersionName] <String>] [-DeployAll] [[-TestLevel] <String>] [[-Tests] <String[]>] [[-Wait] <Int32>] [-Async] [-ConciseResults] [-DetailedResults] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy pipeline start, a beta command of the DevOps Center plugin. It needs a DevOps Center org that you are logged in to (-DevOpsCenterUsername) and the name of the DevOps Center project. Because the command is beta, its name, flags and result can change in a later CLI release. Asks for confirmation and supports -WhatIf. Returns the CLI result, which holds the job ID that Get-SalesforcePipelineDeployStatus, Resume-SalesforcePipelineDeploy and Start-SalesforcePipelineQuickDeploy take.

#### Parameters

- `-DevOpsCenterUsername` (String, required): Username or alias of the DevOps Center org. Passed as --devops-center-username. Required.
- `-DevOpsCenterProjectName` (String, required): Name of the DevOps Center project. Passed as --devops-center-project-name. Required.
- `-BranchName` (String, required): Branch whose changes are deployed to the pipeline stage. Passed as --branch-name. Required.
- `-BundleVersionName` (String): Version name of the bundle to deploy. Passed as --bundle-version-name.
- `-DeployAll` (switch): Deploy all the metadata in the branch, not only the changes. Adds --deploy-all.
- `-TestLevel` (String): Apex testing level. Passed to sf as --test-level. Valid values: NoTests, SpecificTests, TestsInOrg, TestsInOrgAndPackages. Value mapping to the CLI: NoTests = NoTestRun, SpecificTests = RunSpecifiedTests, TestsInOrg = RunLocalTests, TestsInOrgAndPackages = RunAllTestsInOrg. The CLI default applies when omitted.
- `-Tests` (String[]): Apex test classes to run with -TestLevel SpecificTests. Passed as one --tests per name.
- `-Wait` (Int32): Number of minutes to wait for the deployment to finish. Passed as --wait. Cannot be used with -Async.
- `-Async` (switch): Start the deployment and return without waiting. Adds --async.
- `-ConciseResults` (switch): Show concise output of the result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the result. Adds --verbose.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy pipeline start`

#### Examples

```powershell
PS> Start-SalesforcePipelineDeploy -DevOpsCenterUsername doc-org -DevOpsCenterProjectName "Sales App" -BranchName feature/new-flow -TestLevel TestsInOrg -WhatIf
```

Preview deploying a branch with all local tests.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforcePipelineDeploy -Examples"
- For more information, type: "Get-Help Start-SalesforcePipelineDeploy -Detailed"
- For technical information, type: "Get-Help Start-SalesforcePipelineDeploy -Full"
- For online help, type: "Get-Help Start-SalesforcePipelineDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforcePipelineQuickDeploy

#### Synopsis

Deploys a validated pipeline deployment without running the tests again (beta).

#### Syntax

```powershell
Start-SalesforcePipelineQuickDeploy [-DevOpsCenterUsername] <String> [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [-Async] [-ConciseResults] [-DetailedResults] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy pipeline quick, a beta command of the DevOps Center plugin, for the job ID of a validation made with Test-SalesforcePipelineDeploy (or the most recent one with -UseMostRecent). Because the command is beta, its name, flags and result can change in a later CLI release. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-DevOpsCenterUsername` (String, required): Username or alias of the DevOps Center org. Passed as --devops-center-username. Required.
- `-JobId` (String): Job ID of the validated deployment. A 15 or 18 character ID. Passed as --job-id.
- `-UseMostRecent` (switch): Use the validation the CLI ran most recently. Use instead of -JobId. Adds --use-most-recent.
- `-Wait` (Int32): Number of minutes to wait for the deployment to finish. Passed as --wait. Cannot be used with -Async.
- `-Async` (switch): Start the deployment and return without waiting. Adds --async.
- `-ConciseResults` (switch): Show concise output of the result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the result. Adds --verbose.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy pipeline quick`

#### Examples

```powershell
PS> Start-SalesforcePipelineQuickDeploy -DevOpsCenterUsername doc-org -UseMostRecent -WhatIf
```

Preview the quick deploy of the last validation.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforcePipelineQuickDeploy -Examples"
- For more information, type: "Get-Help Start-SalesforcePipelineQuickDeploy -Detailed"
- For technical information, type: "Get-Help Start-SalesforcePipelineQuickDeploy -Full"
- For online help, type: "Get-Help Start-SalesforcePipelineQuickDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforcePipelineDeploy

#### Synopsis

Validates a deployment of a branch to the org of a DevOps Center pipeline stage, without deploying it (beta).

#### Syntax

```powershell
Test-SalesforcePipelineDeploy [-DevOpsCenterUsername] <String> [-DevOpsCenterProjectName] <String> [-BranchName] <String> [[-BundleVersionName] <String>] [-DeployAll] [[-TestLevel] <String>] [[-Tests] <String[]>] [[-Wait] <Int32>] [-Async] [-ConciseResults] [-DetailedResults] [<CommonParameters>]
```

#### Description

Runs sf project deploy pipeline validate, a beta command of the DevOps Center plugin. Nothing is deployed; a passing validation can be released with Start-SalesforcePipelineQuickDeploy. It needs a DevOps Center org that you are logged in to. Because the command is beta, its name, flags and result can change in a later CLI release.

#### Parameters

- `-DevOpsCenterUsername` (String, required): Username or alias of the DevOps Center org. Passed as --devops-center-username. Required.
- `-DevOpsCenterProjectName` (String, required): Name of the DevOps Center project. Passed as --devops-center-project-name. Required.
- `-BranchName` (String, required): Branch whose changes are validated. Passed as --branch-name. Required.
- `-BundleVersionName` (String): Version name of the bundle to validate. Passed as --bundle-version-name.
- `-DeployAll` (switch): Validate all the metadata in the branch, not only the changes. Adds --deploy-all.
- `-TestLevel` (String): Apex testing level. Passed to sf as --test-level. Valid values: NoTests, SpecificTests, TestsInOrg, TestsInOrgAndPackages. Value mapping to the CLI: NoTests = NoTestRun, SpecificTests = RunSpecifiedTests, TestsInOrg = RunLocalTests, TestsInOrgAndPackages = RunAllTestsInOrg. The CLI default applies when omitted.
- `-Tests` (String[]): Apex test classes to run with -TestLevel SpecificTests. Passed as one --tests per name.
- `-Wait` (Int32): Number of minutes to wait for the validation to finish. Passed as --wait. Cannot be used with -Async.
- `-Async` (switch): Start the validation and return without waiting. Adds --async.
- `-ConciseResults` (switch): Show concise output of the result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the result. Adds --verbose.

#### Salesforce CLI

- `sf project deploy pipeline validate`

#### Examples

```powershell
PS> Test-SalesforcePipelineDeploy -DevOpsCenterUsername doc-org -DevOpsCenterProjectName "Sales App" -BranchName main -TestLevel TestsInOrg -Wait 30
```

Validate a branch with all local tests.

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforcePipelineDeploy -Examples"
- For more information, type: "Get-Help Test-SalesforcePipelineDeploy -Detailed"
- For technical information, type: "Get-Help Test-SalesforcePipelineDeploy -Full"
- For online help, type: "Get-Help Test-SalesforcePipelineDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-devops-center>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-logs command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-logs/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

16 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

[Convert-SalesforceDebugLog](#convert-salesforcedebuglog), [Disable-SalesforceDebugLogging](#disable-salesforcedebuglogging), [Enable-SalesforceDebugLogging](#enable-salesforcedebuglogging), [Export-SalesforceDebugLogs](#export-salesforcedebuglogs), [Export-SalesforceEventFile](#export-salesforceeventfile), [Export-SalesforceEventFiles](#export-salesforceeventfiles), [Get-SalesforceDebugLogging](#get-salesforcedebuglogging), [Get-SalesforceDebugLogs](#get-salesforcedebuglogs), [Get-SalesforceEventFile](#get-salesforceeventfile), [Get-SalesforceFlowInterviews](#get-salesforceflowinterviews), [Get-SalesforceLoginFailures](#get-salesforceloginfailures), [Get-SalesforceLoginHistory](#get-salesforceloginhistory), [Out-Notepad](#out-notepad), [Select-SalesforceDebugLogs](#select-salesforcedebuglogs), [Select-SalesforceEventFiles](#select-salesforceeventfiles), [Watch-SalesforceDebugLogs](#watch-salesforcedebuglogs)

### Convert-SalesforceDebugLog

#### Synopsis

Converts the text of a debug log into one object per line (in development).

#### Syntax

```powershell
Convert-SalesforceDebugLog [-Log] <String> [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI. Pipe in the text of a log, for example from Get-SalesforceDebugLogs -Raw; the first (header) line is skipped and each remaining line is split on | into DateTime, LogType and, when present, SubType and Detail. It writes a warning that it is still in development, so the properties may change.

#### Parameters

- `-Log` (String, required): The log text to convert. Accepts pipeline input. Required.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1 | Convert-SalesforceDebugLog | Select-Object -First 20
```

The first twenty log lines as objects.

#### Remarks

- To see the examples, type: "Get-Help Convert-SalesforceDebugLog -Examples"
- For more information, type: "Get-Help Convert-SalesforceDebugLog -Detailed"
- For technical information, type: "Get-Help Convert-SalesforceDebugLog -Full"
- For online help, type: "Get-Help Convert-SalesforceDebugLog -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Disable-SalesforceDebugLogging

#### Synopsis

Deletes a trace flag to stop debug logging (sf apex trace delete).

#### Syntax

```powershell
Disable-SalesforceDebugLogging [-TraceId] <String> [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

-TraceId can come from the pipeline: a trace flag from Get-SalesforceDebugLogging is used through its Id. Each flag is confirmed on its own, so -WhatIf previews every delete, and an org with no trace flags deletes nothing.

#### Parameters

- `-TraceId` (String, required): ID of the trace flag to delete. Passed to sf as --trace-flag-id. Required. Alias: Id, TraceFlagId. Accepts input from the pipeline by property name.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf apex trace delete`

#### Examples

```powershell
PS> Get-SalesforceDebugLogging -TargetOrg myorg | Disable-SalesforceDebugLogging -TargetOrg myorg -WhatIf
```

#### Remarks

- To see the examples, type: "Get-Help Disable-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Disable-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Disable-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Disable-SalesforceDebugLogging -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Enable-SalesforceDebugLogging

#### Synopsis

Turns on debug logging for a user, Apex class or Apex trigger by creating a trace flag.

#### Syntax

```powershell
Enable-SalesforceDebugLogging -TracedEntityId <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -Username <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -ApexClass <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Enable-SalesforceDebugLogging -ApexTrigger <String> -DebugLevel <String> [-LogType <String>] [-Duration <Int32>] [-TargetOrg <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf apex trace create for a user. Identify what to trace with one of -TracedEntityId, -Username, -ApexClass or -ApexTrigger; the last three are looked up with a SOQL query first and the cmdlet stops if no record, or more than one, matches. -DebugLevel names an existing debug level. The trace flag stays until it expires or you remove it with Disable-SalesforceDebugLogging.

Salesforce traces an Apex class or trigger only with a CLASS_TRACING trace flag, which sf apex trace create cannot make. So for -ApexClass, -ApexTrigger, or a -TracedEntityId of a class (01p) or trigger (01q), psfdx looks up the debug level's ID and creates the TraceFlag Tooling API record itself with New-SalesforceRecord, starting now and expiring after -Duration minutes (30 by default, as sf does). -LogType does not apply there.

#### Parameters

- `-TracedEntityId` (String, required): ID of the user, Apex class, or Apex trigger to trace. Passed to sf as --traced-entity-id. Required in the Id parameter set.
- `-Username` (String, required): User name of the user to trace. psfdx looks up the user's ID and passes it as --traced-entity-id. Required in the Username parameter set.
- `-ApexClass` (String, required): Name of the Apex class to trace. psfdx looks up its ID and creates a CLASS_TRACING trace flag for it. Required in the ApexClass parameter set.
- `-ApexTrigger` (String, required): Name of the Apex trigger to trace. psfdx looks up its ID and creates a CLASS_TRACING trace flag for it. Required in the ApexTrigger parameter set.
- `-DebugLevel` (String, required): Developer name of an existing debug level to apply. Passed to sf as --debug-level. Required.
- `-LogType` (String): Type of trace flag to create for a user. Passed to sf as --log-type. Valid values: DEVELOPER_LOG, USER_DEBUG. Not allowed when tracing an Apex class or trigger, which always uses CLASS_TRACING.
- `-Duration` (Int32): Duration, in minutes, before the trace flag expires. Maximum is 1440 (24 hours). Passed to sf as --duration; for an Apex class or trigger it sets the trace flag's ExpirationDate (default 30). Range: 1 to 1440.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf apex trace create`

#### Examples

```powershell
PS> Enable-SalesforceDebugLogging -Username me@example.com -DebugLevel SFDC_DevConsole -Duration 60 -TargetOrg dev1
```

Trace one user for an hour.

#### Remarks

- To see the examples, type: "Get-Help Enable-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Enable-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Enable-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Enable-SalesforceDebugLogging -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Export-SalesforceDebugLogs

#### Synopsis

Saves the most recent debug logs to files.

#### Syntax

```powershell
Export-SalesforceDebugLogs [[-Limit] <Int32>] [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Lists the logs with Select-SalesforceDebugLogs, keeps the first -Limit of them and writes each one with Get-SalesforceDebugLogs to &lt;log id&gt;.log in the output folder, with a progress bar. Existing files with the same name are overwritten.

#### Parameters

- `-Limit` (Int32): How many logs to save, taken from the start of the list the CLI returns. Default 50. Default: 50.
- `-OutputFolder` (String): Folder to write the .log files to. It must exist. Defaults to the current folder.
- `-TargetOrg` (String): Username or alias of the org to read the logs from. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Export-SalesforceDebugLogs -Limit 5 -OutputFolder .\logs -TargetOrg dev1
```

Save the five newest logs.

#### Remarks

- To see the examples, type: "Get-Help Export-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Export-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Export-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Export-SalesforceDebugLogs -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Export-SalesforceEventFile

#### Synopsis

Downloads one Event Monitoring log file and saves it as a CSV.

#### Syntax

```powershell
Export-SalesforceEventFile [-Id] <String> [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Gets the file with Get-SalesforceEventFile and writes it to &lt;Id&gt;.csv in the output folder. The ID must be a 15 or 18 character Salesforce ID, so it cannot point outside the folder.

#### Parameters

- `-Id` (String, required): ID of the EventLogFile record. Required.
- `-OutputFolder` (String): Folder to write the CSV to. It must exist. Defaults to the current folder.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Export-SalesforceEventFile -Id 0AT000000000001AAA -OutputFolder .\events -TargetOrg prod
```

Save one event log file.

#### Remarks

- To see the examples, type: "Get-Help Export-SalesforceEventFile -Examples"
- For more information, type: "Get-Help Export-SalesforceEventFile -Detailed"
- For technical information, type: "Get-Help Export-SalesforceEventFile -Full"
- For online help, type: "Get-Help Export-SalesforceEventFile -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Export-SalesforceEventFiles

#### Synopsis

Downloads several Event Monitoring log files as CSVs.

#### Syntax

```powershell
Export-SalesforceEventFiles [[-EventType] <String>] [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-OutputFolder] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Finds files with Select-SalesforceEventFiles using the filters you give, then saves each one with Export-SalesforceEventFile, with a progress bar. See Select-SalesforceEventFiles for how the filters work.

#### Parameters

- `-EventType` (String): SOQL query to execute. Passed to sf as --query.
- `-After` (DateTime): SOQL query to execute. Passed to sf as --query.
- `-Before` (DateTime): SOQL query to execute. Passed to sf as --query.
- `-Limit` (Int32): SOQL query to execute. Passed to sf as --query. Default: 200.
- `-OutputFolder` (String): Folder to write the CSV files to. It must exist. Defaults to the current folder.
- `-TargetOrg` (String): 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 data query`

#### Examples

```powershell
PS> Export-SalesforceEventFiles -EventType Login -After (Get-Date).AddDays(-7) -OutputFolder .\events -TargetOrg prod
```

Last week's login event files.

#### Remarks

- To see the examples, type: "Get-Help Export-SalesforceEventFiles -Examples"
- For more information, type: "Get-Help Export-SalesforceEventFiles -Detailed"
- For technical information, type: "Get-Help Export-SalesforceEventFiles -Full"
- For online help, type: "Get-Help Export-SalesforceEventFiles -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDebugLogging

#### Synopsis

Lists the trace flags that turn on debug logging.

#### Syntax

```powershell
Get-SalesforceDebugLogging [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex trace list and returns one object per trace flag. Pipe them to Disable-SalesforceDebugLogging to remove them.

#### Parameters

- `-TargetOrg` (String): 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 apex trace list`

#### Examples

```powershell
PS> Get-SalesforceDebugLogging -TargetOrg dev1
```

Active trace flags.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDebugLogging -Examples"
- For more information, type: "Get-Help Get-SalesforceDebugLogging -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDebugLogging -Full"
- For online help, type: "Get-Help Get-SalesforceDebugLogging -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDebugLogs

#### Synopsis

Fetches one debug log, or the newest few, from an org.

#### Syntax

```powershell
Get-SalesforceDebugLogs [[-OutputDirectory] <String>] [[-LogId] <String>] [[-Last] <Int32>] [-Raw] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex get log with --log-id or --number. Give exactly one of -LogId and -Last. With -OutputDirectory the CLI saves the logs as files; with -Raw the text is returned as it is.

#### Parameters

- `-OutputDirectory` (String): Directory for saving the log files. Passed to sf as --output-dir.
- `-LogId` (String): ID of the specific log to display. Passed to sf as --log-id.
- `-Last` (Int32): Fetch this many of the newest logs. Passed as --number. Use instead of -LogId.
- `-Raw` (switch): Return the log text as the CLI prints it.
- `-TargetOrg` (String): 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 apex get log`

#### Examples

```powershell
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1
```

The newest log, as text.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Get-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Get-SalesforceDebugLogs -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceEventFile

#### Synopsis

Downloads the content of one Event Monitoring log file.

#### Syntax

```powershell
Get-SalesforceEventFile [-Id] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Finds the newest REST API version of the org, then runs sf api request rest on /services/data/&lt;version&gt;/sobjects/EventLogFile/&lt;Id&gt;/Logfile and returns the CSV text. The ID must be a 15 or 18 character Salesforce ID.

#### Parameters

- `-Id` (String, required): ID of the EventLogFile record. Required.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org. Passed to sf as --target-org.

#### Salesforce CLI

- `sf api request rest`

#### Examples

```powershell
PS> Get-SalesforceEventFile -Id 0AT000000000001AAA -TargetOrg prod
```

The CSV of that file.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceEventFile -Examples"
- For more information, type: "Get-Help Get-SalesforceEventFile -Detailed"
- For technical information, type: "Get-Help Get-SalesforceEventFile -Full"
- For online help, type: "Get-Help Get-SalesforceEventFile -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-api>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceFlowInterviews

#### Synopsis

Lists flow interviews, for example the ones that failed.

#### Syntax

```powershell
Get-SalesforceFlowInterviews [[-Type] <String>] [[-After] <DateTime>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf data query on FlowInterview (Id, CreatedDate, InterviewLabel, InterviewStatus, Error) filtered by status and optional date, newest first. Values are escaped as SOQL literals.

#### Parameters

- `-Type` (String): Interview status to list: Error, Paused, Running, Completed, VersionPaused, Autosaved, Expired, or All (the default). Default: All. Valid values: Error, Paused, Running, Completed, VersionPaused, Autosaved, Expired, All.
- `-After` (DateTime): Only interviews created at or after this time.
- `-Limit` (Int32): SOQL query to execute. Passed to sf as --query. Default: 200.
- `-TargetOrg` (String): 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 data query`

#### Examples

```powershell
PS> Get-SalesforceFlowInterviews -Type Error -After (Get-Date).AddDays(-1) -TargetOrg prod
```

Flow errors in the last day.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceFlowInterviews -Examples"
- For more information, type: "Get-Help Get-SalesforceFlowInterviews -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFlowInterviews -Full"
- For online help, type: "Get-Help Get-SalesforceFlowInterviews -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceLoginFailures

#### Synopsis

Lists login attempts that did not succeed.

#### Syntax

```powershell
Get-SalesforceLoginFailures [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-Username] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Calls Get-SalesforceLoginHistory with the same filters and keeps the rows whose Status is not Success. Returns an empty array when there are none.

#### Parameters

- `-After` (DateTime): Only logins at or after this time.
- `-Before` (DateTime): Only logins at or before this time.
- `-Limit` (Int32): Maximum number of login history rows to read before filtering.
- `-Username` (String): Only this user name.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceLoginFailures -After (Get-Date).AddDays(-1) -TargetOrg prod
```

Failed logins in the last day.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceLoginFailures -Examples"
- For more information, type: "Get-Help Get-SalesforceLoginFailures -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLoginFailures -Full"
- For online help, type: "Get-Help Get-SalesforceLoginFailures -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceLoginHistory

#### Synopsis

Lists login history records, newest first.

#### Syntax

```powershell
Get-SalesforceLoginHistory [[-After] <DateTime>] [[-Before] <DateTime>] [[-Username] <String>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf data query on LoginHistory (Id, LoginTime, UserId, SourceIp, Application, Status). The user filter is applied through a subquery on User. Values are escaped as SOQL literals.

#### Parameters

- `-After` (DateTime): Only logins at or after this time.
- `-Before` (DateTime): Only logins at or before this time.
- `-Username` (String): Only this user name.
- `-Limit` (Int32): SOQL query to execute. Passed to sf as --query.
- `-TargetOrg` (String): 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 data query`

#### Examples

```powershell
PS> Get-SalesforceLoginHistory -Username me@example.com -Limit 20 -TargetOrg prod
```

The last twenty logins of one user.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceLoginHistory -Examples"
- For more information, type: "Get-Help Get-SalesforceLoginHistory -Detailed"
- For technical information, type: "Get-Help Get-SalesforceLoginHistory -Full"
- For online help, type: "Get-Help Get-SalesforceLoginHistory -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Out-Notepad

#### Synopsis

Shows text in Notepad (Windows only).

#### Syntax

```powershell
Out-Notepad [-Content] <String> [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI. Pipe text in; it is written to a new temporary file that Notepad opens. The file is not deleted afterwards, so remove it if the text is sensitive. On other systems it does nothing.

#### Parameters

- `-Content` (String, required): The text to show. Accepts pipeline input. Required.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceDebugLogs -Last 1 -Raw -TargetOrg dev1 | Out-Notepad
```

Read the newest log in Notepad.

#### Remarks

- To see the examples, type: "Get-Help Out-Notepad -Examples"
- For more information, type: "Get-Help Out-Notepad -Detailed"
- For technical information, type: "Get-Help Out-Notepad -Full"
- For online help, type: "Get-Help Out-Notepad -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Select-SalesforceDebugLogs

#### Synopsis

Lists the debug logs in an org.

#### Syntax

```powershell
Select-SalesforceDebugLogs [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex list log and returns one object per log (Id, Application, Operation, StartTime, LogLength, and so on), in the order the CLI returns them.

#### Parameters

- `-TargetOrg` (String): 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 apex list log`

#### Examples

```powershell
PS> Select-SalesforceDebugLogs -TargetOrg dev1 | Select-Object -First 5
```

The five newest logs.

#### Remarks

- To see the examples, type: "Get-Help Select-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Select-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Select-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Select-SalesforceDebugLogs -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Select-SalesforceEventFiles

#### Synopsis

Lists Event Monitoring log files.

#### Syntax

```powershell
Select-SalesforceEventFiles [[-EventType] <String>] [[-After] <DateTime>] [[-Before] <DateTime>] [[-Limit] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf data query on EventLogFile (Id, EventType, LogDate, LogFileLength, Sequence, Interval, CreatedDate), newest log date first, with optional filters. Values are escaped as SOQL literals.

#### Parameters

- `-EventType` (String): Only this event type, for example Login or ApexExecution. Passed to sf as --query.
- `-After` (DateTime): Only files with a LogDate at or after this time. Passed to sf as --query.
- `-Before` (DateTime): Only files with a LogDate at or before this time. Passed to sf as --query.
- `-Limit` (Int32): Maximum number of files to return. Passed to sf as --query.
- `-TargetOrg` (String): 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 data query`

#### Examples

```powershell
PS> Select-SalesforceEventFiles -EventType Login -Limit 10 -TargetOrg prod
```

The ten newest login files.

#### Remarks

- To see the examples, type: "Get-Help Select-SalesforceEventFiles -Examples"
- For more information, type: "Get-Help Select-SalesforceEventFiles -Detailed"
- For technical information, type: "Get-Help Select-SalesforceEventFiles -Full"
- For online help, type: "Get-Help Select-SalesforceEventFiles -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Watch-SalesforceDebugLogs

#### Synopsis

Streams debug logs from an org to the terminal.

#### Syntax

```powershell
Watch-SalesforceDebugLogs [[-DebugLevel] <String>] [-SkipTraceFlag] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf apex tail log with --color, which keeps running until you press Ctrl+C. Unless you pass -SkipTraceFlag the CLI first creates a trace flag for you, which stays after you stop.

#### Parameters

- `-DebugLevel` (String): Debug level to set on the DEVELOPER_LOG trace flag for your user. Passed to sf as --debug-level.
- `-SkipTraceFlag` (switch): Skip trace flag setup. Assumes that a trace flag and debug level are fully set up. Adds --skip-trace-flag.
- `-TargetOrg` (String): 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 apex tail log`

#### Examples

```powershell
PS> Watch-SalesforceDebugLogs -DebugLevel SFDC_DevConsole -TargetOrg dev1
```

Follow the logs of the org.

#### Remarks

- To see the examples, type: "Get-Help Watch-SalesforceDebugLogs -Examples"
- For more information, type: "Get-Help Watch-SalesforceDebugLogs -Detailed"
- For technical information, type: "Get-Help Watch-SalesforceDebugLogs -Full"
- For online help, type: "Get-Help Watch-SalesforceDebugLogs -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-apex>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-metadata command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-metadata/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

45 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Objects, fields and metadata discovery**: [Build-SalesforceQuery](#build-salesforcequery), [Clear-SalesforceMetadataTypeCache](#clear-salesforcemetadatatypecache), [Describe-SalesforceFields](#describe-salesforcefields), [Describe-SalesforceMetadataTypes](#describe-salesforcemetadatatypes), [Describe-SalesforceObject](#describe-salesforceobject), [Describe-SalesforceObjects](#describe-salesforceobjects), [Get-SalesforceMetadataComponents](#get-salesforcemetadatacomponents)

**Other commands**: [Compare-SalesforceFields](#compare-salesforcefields), [Compare-SalesforceMetadata](#compare-salesforcemetadata), [Compare-SalesforcePermissions](#compare-salesforcepermissions), [Get-SalesforceFieldInventory](#get-salesforcefieldinventory), [Get-SalesforceFlows](#get-salesforceflows)

**Source and tracking**: [ConvertTo-SalesforceMetadataApiFormat](#convertto-salesforcemetadataapiformat), [ConvertTo-SalesforceSourceFormat](#convertto-salesforcesourceformat), [Enable-SalesforceSourceBehavior](#enable-salesforcesourcebehavior), [Get-SalesforceIgnoredFiles](#get-salesforceignoredfiles), [Remove-SalesforceSource](#remove-salesforcesource), [Remove-SalesforceSourceTracking](#remove-salesforcesourcetracking), [Reset-SalesforceSourceTracking](#reset-salesforcesourcetracking)

**Deployments**: [Deploy-SalesforceComponent](#deploy-salesforcecomponent), [Deploy-SalesforceMetadata](#deploy-salesforcemetadata), [Get-SalesforceDeployPreview](#get-salesforcedeploypreview), [Get-SalesforceDeployStatus](#get-salesforcedeploystatus), [Get-SalesforceDeploySummary](#get-salesforcedeploysummary), [Resume-SalesforceDeploy](#resume-salesforcedeploy), [Start-SalesforceQuickDeploy](#start-salesforcequickdeploy), [Stop-SalesforceDeploy](#stop-salesforcedeploy), [Test-SalesforceDeploy](#test-salesforcedeploy)

**Retrieval**: [Get-SalesforceRetrievePreview](#get-salesforceretrievepreview), [Retrieve-SalesforceComponent](#retrieve-salesforcecomponent), [Retrieve-SalesforceField](#retrieve-salesforcefield), [Retrieve-SalesforceMetadata](#retrieve-salesforcemetadata), [Retrieve-SalesforceOrg](#retrieve-salesforceorg), [Retrieve-SalesforcePackage](#retrieve-salesforcepackage), [Retrieve-SalesforceValidationRule](#retrieve-salesforcevalidationrule)

**Metadata generation**: [New-SalesforceCustomField](#new-salesforcecustomfield), [New-SalesforceCustomMetadataField](#new-salesforcecustommetadatafield), [New-SalesforceCustomMetadataRecord](#new-salesforcecustommetadatarecord), [New-SalesforceCustomMetadataRecordsFromCsv](#new-salesforcecustommetadatarecordsfromcsv), [New-SalesforceCustomMetadataType](#new-salesforcecustommetadatatype), [New-SalesforceCustomMetadataTypeFromOrg](#new-salesforcecustommetadatatypefromorg), [New-SalesforceCustomObject](#new-salesforcecustomobject), [New-SalesforceCustomTab](#new-salesforcecustomtab), [New-SalesforceManifest](#new-salesforcemanifest), [New-SalesforcePlatformEvent](#new-salesforceplatformevent)

## Objects, fields and metadata discovery

### Build-SalesforceQuery

#### Synopsis

Builds a SELECT statement that lists every field of an object.

#### Syntax

```powershell
Build-SalesforceQuery [-ObjectName] <String> [[-TargetOrg] <String>] [-UseToolingApi] [-ExcludeAuditFields] [-ExcludeNameFields] [-ExcludeContextFields] [<CommonParameters>]
```

#### Description

Reads the object's fields with Describe-SalesforceFields and returns the query text, for example SELECT Id,Name FROM Account. Use the switches to leave out groups of fields. Returns an empty string when the object has no fields. Field and object names are checked so only valid API names end up in the query.

#### Parameters

- `-ObjectName` (String, required): API name of the object. Required.
- `-TargetOrg` (String): Username or alias of the org to describe. If omitted, the Salesforce CLI uses the default target org.
- `-UseToolingApi` (switch): Describe a Tooling API object instead of a standard or custom one.
- `-ExcludeAuditFields` (switch): Leave out CreatedById, CreatedDate, LastModifiedById, LastModifiedDate, SystemModstamp and IsDeleted.
- `-ExcludeNameFields` (switch): Leave out Name, FirstName, LastName and Subject.
- `-ExcludeContextFields` (switch): Leave out OwnerId, RecordTypeId, CurrencyIsoCode and Division.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Build-SalesforceQuery -ObjectName Account -ExcludeAuditFields -TargetOrg dev1
PS> A query for the fields of Account without the audit fields.
```

#### Remarks

- To see the examples, type: "Get-Help Build-SalesforceQuery -Examples"
- For more information, type: "Get-Help Build-SalesforceQuery -Detailed"
- For technical information, type: "Get-Help Build-SalesforceQuery -Full"
- For online help, type: "Get-Help Build-SalesforceQuery -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Clear-SalesforceMetadataTypeCache

#### Synopsis

Forgets the metadata types psfdx cached for -Type completion.

#### Syntax

```powershell
Clear-SalesforceMetadataTypeCache [<CommonParameters>]
```

#### Description

Does not use the Salesforce CLI. psfdx caches each org's list of metadata types for the session so -Type can be completed and checked (an unknown type gives a warning); this removes the cache for every org so the next use asks the org again.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Clear-SalesforceMetadataTypeCache
```

Force a fresh list of metadata types.

#### Remarks

- To see the examples, type: "Get-Help Clear-SalesforceMetadataTypeCache -Examples"
- For more information, type: "Get-Help Clear-SalesforceMetadataTypeCache -Detailed"
- For technical information, type: "Get-Help Clear-SalesforceMetadataTypeCache -Full"
- For online help, type: "Get-Help Clear-SalesforceMetadataTypeCache -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Describe-SalesforceFields

#### Synopsis

Lists the fields of an object.

#### Syntax

```powershell
Describe-SalesforceFields [-ObjectName] <String> [[-TargetOrg] <String>] [-UseToolingApi] [<CommonParameters>]
```

#### Description

Describes the object with Describe-SalesforceObject and returns the complete describe of each field, sorted by name: every property the API returns, including custom, nillable, referenceTo, relationshipName, calculated, calculatedFormula, length, precision, scale, unique, externalId, picklistValues, createable and updateable. False, null and empty values are kept as the API sent them. A namespaced field keeps its prefix in name (ns__Field__c). The default table still shows name, label, type and byteLength; use Select-Object or Format-List * to see the rest. Earlier versions returned only those four properties, so Export-Csv now writes every property: select the columns you want first.

#### Parameters

- `-ObjectName` (String, required): API name of the object. Required.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.
- `-UseToolingApi` (switch): Describe a Tooling API object instead of a standard or custom one.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Describe-SalesforceFields -ObjectName Account -TargetOrg dev1
```

The fields of Account.

#### Remarks

- To see the examples, type: "Get-Help Describe-SalesforceFields -Examples"
- For more information, type: "Get-Help Describe-SalesforceFields -Detailed"
- For technical information, type: "Get-Help Describe-SalesforceFields -Full"
- For online help, type: "Get-Help Describe-SalesforceFields -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Describe-SalesforceMetadataTypes

#### Synopsis

Lists the metadata types enabled in an org.

#### Syntax

```powershell
Describe-SalesforceMetadataTypes [[-TargetOrg] <String>] [[-OutputFile] <String>] [-Detailed] [<CommonParameters>]
```

#### Description

Runs sf org list metadata-types and returns the type names (the xmlName of each type), for example ApexClass. With -Detailed it returns the complete object for each type instead: xmlName, directoryName, suffix, inFolder, metaFile and childXmlNames. Returns an empty array when the org reports none. A CLI failure, such as a missing authorization, throws instead of returning an empty list.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-OutputFile` (String): Path of a file for the CLI to write the full result to (the type names with their suffix, directory and whether they have folders). Passed to sf as --output-file. The folder it goes in must exist. The cmdlet still returns the type names, or the full objects with -Detailed.
- `-Detailed` (switch): Optional switch. Return the complete object for each metadata type (xmlName, directoryName, suffix, inFolder, metaFile, childXmlNames) instead of only its name. Applied by psfdx; no CLI flag.

#### Salesforce CLI

- `sf org list metadata-types`

#### Examples

```powershell
PS> Describe-SalesforceMetadataTypes -TargetOrg dev1
```

Every metadata type the org supports.

#### Remarks

- To see the examples, type: "Get-Help Describe-SalesforceMetadataTypes -Examples"
- For more information, type: "Get-Help Describe-SalesforceMetadataTypes -Detailed"
- For technical information, type: "Get-Help Describe-SalesforceMetadataTypes -Full"
- For online help, type: "Get-Help Describe-SalesforceMetadataTypes -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Describe-SalesforceObject

#### Synopsis

Describes one object: fields, relationships and settings.

#### Syntax

```powershell
Describe-SalesforceObject [-Name] <String> [[-TargetOrg] <String>] [-UseToolingApi] [<CommonParameters>]
```

#### Description

Runs sf sobject describe and returns the full description as an object. Use Describe-SalesforceFields for just the field list.

#### Parameters

- `-Name` (String, required): API name of the object. Passed as --sobject. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-UseToolingApi` (switch): Use Tooling API to display metadata for Tooling API objects. Adds --use-tooling-api.

#### Salesforce CLI

- `sf sobject describe`

#### Examples

```powershell
PS> Describe-SalesforceObject -Name Account -TargetOrg dev1
```

The full description of Account.

#### Remarks

- To see the examples, type: "Get-Help Describe-SalesforceObject -Examples"
- For more information, type: "Get-Help Describe-SalesforceObject -Detailed"
- For technical information, type: "Get-Help Describe-SalesforceObject -Full"
- For online help, type: "Get-Help Describe-SalesforceObject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-schema>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Describe-SalesforceObjects

#### Synopsis

Lists the objects in an org.

#### Syntax

```powershell
Describe-SalesforceObjects [[-TargetOrg] <String>] [[-Category] <String>] [<CommonParameters>]
```

#### Description

Runs sf sobject list and returns the object names. With no category the CLI lists all objects.

#### Parameters

- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-Category` (String): Which objects to list. Valid values: all, standard, custom. The CLI default is all. Passed to sf as --sobject.

#### Salesforce CLI

- `sf sobject list`

#### Examples

```powershell
PS> Describe-SalesforceObjects -TargetOrg dev1
```

Every object name.

#### Remarks

- To see the examples, type: "Get-Help Describe-SalesforceObjects -Examples"
- For more information, type: "Get-Help Describe-SalesforceObjects -Detailed"
- For technical information, type: "Get-Help Describe-SalesforceObjects -Full"
- For online help, type: "Get-Help Describe-SalesforceObjects -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-schema>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceMetadataComponents

#### Synopsis

Lists the metadata components of one type that exist in an org.

#### Syntax

```powershell
Get-SalesforceMetadataComponents [-MetadataType] <String> [[-Folder] <String>] [[-OutputFile] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf org list metadata for a metadata type, for example ApexClass or CustomObject, and returns one object per component (fullName, fileName, type, id, createdDate, lastModifiedDate and who changed it). Use Describe-SalesforceMetadataTypes to see which types an org has. Types that live in folders, such as Report or EmailTemplate, need -Folder.

#### Parameters

- `-MetadataType` (String, required): Metadata type to list, for example ApexClass. Passed to sf as --metadata-type. Required. Tab completion offers the org's types and the types the CLI lists; a type in neither gives a warning but is still passed.
- `-Folder` (String): Folder that holds the components, for types that are stored in folders. Passed to sf as --folder.
- `-OutputFile` (String): Path of a file for the CLI to write the result to. Passed to sf as --output-file. The folder it goes in must exist. The cmdlet still returns the components.
- `-TargetOrg` (String): 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 org list metadata`

#### Examples

```powershell
PS> Get-SalesforceMetadataComponents -MetadataType ApexClass -TargetOrg dev1 | Select-Object fullName, lastModifiedDate
```

Every Apex class in dev1 and when it last changed.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceMetadataComponents -Examples"
- For more information, type: "Get-Help Get-SalesforceMetadataComponents -Detailed"
- For technical information, type: "Get-Help Get-SalesforceMetadataComponents -Full"
- For online help, type: "Get-Help Get-SalesforceMetadataComponents -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Other commands

### Compare-SalesforceFields

#### Synopsis

Compares the fields of objects in two orgs: fields missing from either org, and changed type, length, requiredness, lookups, formulas and picklist values.

#### Syntax

```powershell
Compare-SalesforceFields [-SourceOrg] <String> [-TargetOrg] <String> [-ObjectName] <String[]> [-CustomOnly] [<CommonParameters>]
```

#### Description

Reads the field inventory of each object in the source and the target org with Get-SalesforceFieldInventory and returns one object per difference, with ObjectName, FieldName, NamespacePrefix, Difference, Property, SourceValue, TargetValue, SourceOrg and TargetOrg. Nothing is deployed or changed in either org. Difference is MissingInTarget or MissingInSource for a field that exists in one org only (Property is Type and the values are its type), Changed for a property that differs (one row per property), or ObjectMissingInTarget, ObjectMissingInSource or ObjectMissingInBoth when the object itself is absent. The properties compared are Type, Length, Precision, Scale, Nillable (whether the field can be empty), Custom, ReferenceTo, RelationshipName, Calculated, Formula, Unique, ExternalId and PicklistValues (the active values). Lists are compared as sorted sets, so only a different set of values is a difference, not a different order. Field names are matched ignoring case, as Salesforce does. An object that does not exist in an org is reported as a difference. Any other failure, such as a missing authorization or no access to the object, throws with the org's name, so an access problem is never reported as an absent object. Identical orgs return nothing. The rows are sorted by object, field and property, so two runs give the same output.

#### Parameters

- `-SourceOrg` (String, required): Username or alias of the org to compare from. Required.
- `-TargetOrg` (String, required): Username or alias of the org to compare with. Required.
- `-ObjectName` (String[], required): API names of the objects to compare. Required.
- `-CustomOnly` (switch): Optional switch. Compare custom fields only.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Compare-SalesforceFields -SourceOrg uat -TargetOrg prod -ObjectName Account, Opportunity | Format-Table ObjectName, FieldName, Difference, Property, SourceValue, TargetValue
```

The field differences between UAT and production on two objects.

#### Remarks

- To see the examples, type: "Get-Help Compare-SalesforceFields -Examples"
- For more information, type: "Get-Help Compare-SalesforceFields -Detailed"
- For technical information, type: "Get-Help Compare-SalesforceFields -Full"
- For online help, type: "Get-Help Compare-SalesforceFields -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Compare-SalesforceMetadata

#### Synopsis

Compares the metadata components of chosen types in two orgs: components missing from either org and, with -IncludeContent, components whose content differs.

#### Syntax

```powershell
Compare-SalesforceMetadata [-SourceOrg] <String> [-TargetOrg] <String> [-MetadataType] <String[]> [-IncludeContent] [<CommonParameters>]
```

#### Description

Lists the components of each metadata type in the source and the target org with Get-SalesforceMetadataComponents and returns one object per difference, with MetadataType, FullName, NamespacePrefix, Difference, Detail, SourceValue, TargetValue, SourceOrg and TargetOrg. Nothing is deployed or changed in either org. Difference is MissingInTarget or MissingInSource for a component that exists in one org only. With -IncludeContent each type is also retrieved from both orgs into temporary folders (Metadata API format) and the files of components in both orgs are compared after normalising line endings, trailing spaces and blank lines; a file that still differs is one ContentChanged row, with Detail set to its path and SourceValue and TargetValue set to the SHA-256 hash of each normalised file. FullName is then read from the file name. The temporary folders are deleted afterwards. A type that an org cannot list or retrieve (an unsupported type, or one that needs a folder, such as Report) is reported as Unsupported or RetrieveFailed, with the CLI message in Detail and the org it applies to in SourceValue or TargetValue, instead of being skipped silently. A missing authorization or other access failure throws with the org's name, so it is never reported as missing components. Identical orgs return nothing. Rows are sorted by type and name.

#### Parameters

- `-SourceOrg` (String, required): Username or alias of the org to compare from. Required. Passed to sf as --target-org.
- `-TargetOrg` (String, required): Username or alias of the org to compare with. Required. Passed to sf as --target-org.
- `-MetadataType` (String[], required): Metadata types to compare, for example ApexClass, Flow or CustomObject. Required. With -IncludeContent each is passed to sf as --metadata.
- `-IncludeContent` (switch): Optional switch. Also retrieve the components and compare their content. Slower, and it downloads the metadata of these types from both orgs.

#### Salesforce CLI

- `sf project retrieve start`

#### Examples

```powershell
PS> Compare-SalesforceMetadata -SourceOrg uat -TargetOrg prod -MetadataType ApexClass, Flow | Format-Table MetadataType, FullName, Difference
```

Classes and flows that exist in only one of the two orgs.

#### Remarks

- To see the examples, type: "Get-Help Compare-SalesforceMetadata -Examples"
- For more information, type: "Get-Help Compare-SalesforceMetadata -Detailed"
- For technical information, type: "Get-Help Compare-SalesforceMetadata -Full"
- For online help, type: "Get-Help Compare-SalesforceMetadata -Online"

#### Related Links

- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Compare-SalesforcePermissions

#### Synopsis

Compares the object and field permissions that named permission sets and profiles grant in two orgs.

#### Syntax

```powershell
Compare-SalesforcePermissions [-SourceOrg] <String> [-TargetOrg] <String> [[-PermissionSet] <String[]>] [[-Profile] <String[]>] [[-ObjectName] <String[]>] [<CommonParameters>]
```

#### Description

Reads the named permission sets and profiles and their ObjectPermissions and FieldPermissions in the source and the target org with SOQL, and returns one object per difference, with Scope (PermissionSet or Profile), Name, Kind (Container, Object or Field), ObjectName, FieldName, Permission, Difference, SourceValue, TargetValue, SourceOrg and TargetOrg. Nothing is deployed or changed in either org. Only the permission sets and profiles you name are compared: give -PermissionSet, -Profile or both. A permission set or profile that exists in one org only is reported once, with Kind Container and Difference MissingInTarget, MissingInSource or MissingInBoth, and its permissions are not compared. For one that exists in both, each object permission (Read, Create, Edit, Delete, ViewAllRecords, ModifyAllRecords) and field permission (Read, Edit) that differs is one row with Difference Changed and the two true or false values. An object or field with no permission record in an org has no access there, as in Salesforce, so it compares as false. This compares what the named permission sets and profiles grant. It is not a user's effective access, which also depends on their other permission sets and groups, muting permission sets, sharing and the user's licence. -ObjectName limits the comparison to some objects and their fields. A query that fails for any reason, such as a missing authorization, throws with the org's name. Identical orgs return nothing. The rows are sorted, so two runs give the same output.

#### Parameters

- `-SourceOrg` (String, required): Username or alias of the org to compare from. Required. Passed to sf as --target-org for the source queries.
- `-TargetOrg` (String, required): Username or alias of the org to compare with. Required. Passed to sf as --target-org for the target queries.
- `-PermissionSet` (String[]): API names of the permission sets to compare. Give this, -Profile or both.
- `-Profile` (String[]): Names of the profiles to compare, for example 'System Administrator'. Give this, -PermissionSet or both.
- `-ObjectName` (String[]): Optional. Compare only the permissions on these objects and their fields.

#### Salesforce CLI

- `sf data query`

#### Examples

```powershell
PS> Compare-SalesforcePermissions -SourceOrg uat -TargetOrg prod -PermissionSet Sales_Ops -ObjectName Opportunity | Format-Table Kind, ObjectName, FieldName, Permission, SourceValue, TargetValue
```

How the Sales_Ops permission set differs on Opportunity between UAT and production.

#### Remarks

- To see the examples, type: "Get-Help Compare-SalesforcePermissions -Examples"
- For more information, type: "Get-Help Compare-SalesforcePermissions -Detailed"
- For technical information, type: "Get-Help Compare-SalesforcePermissions -Full"
- For online help, type: "Get-Help Compare-SalesforcePermissions -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceFieldInventory

#### Synopsis

Lists the fields of one or more objects as a flat inventory: API name, type, custom, nillable, lookup target, formula and namespace.

#### Syntax

```powershell
Get-SalesforceFieldInventory [-ObjectName] <String[]> [-CustomOnly] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Describes each object with Describe-SalesforceObject and returns one flat object per field, sorted by object and field name, with ObjectName, Name, Label, Type, Length, Precision, Scale, Custom, Nillable, ReferenceTo, RelationshipName, Calculated, Formula, NamespacePrefix, Unique, ExternalId, Createable, Updateable, DefaultedOnCreate and PicklistValues (the active values of a picklist, empty for other fields). Every value is copied from the field describe. A property the describe does not include is $null, never a guess. ReferenceTo is always an array (empty for a field that is not a lookup). NamespacePrefix is read from the API name: a name such as acme__Score__c has the prefix acme, because a field's own name cannot contain a double underscore; standard fields and local custom fields have none. -CustomOnly keeps only custom fields. Use Describe-SalesforceFields when you need every property of the describe.

#### Parameters

- `-ObjectName` (String[], required): API names of the objects, for example Account or Invoice__c. Required. Each object is described once.
- `-CustomOnly` (switch): Optional switch. Return only custom fields (custom is true).
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforceFieldInventory -ObjectName Account -CustomOnly -TargetOrg dev1 | Format-Table Name, Type, Nillable, ReferenceTo, Calculated
```

The custom fields of Account.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceFieldInventory -Examples"
- For more information, type: "Get-Help Get-SalesforceFieldInventory -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFieldInventory -Full"
- For online help, type: "Get-Help Get-SalesforceFieldInventory -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceFlows

#### Synopsis

Lists the flows in an org with their active version, API version and whether a newer draft exists.

#### Syntax

```powershell
Get-SalesforceFlows [-ActiveOnly] [[-Name] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Queries the Tooling API objects FlowDefinition and Flow (the flow versions) and returns one object per flow definition: Name (the API name), Label, NamespacePrefix, ProcessType, IsActive, ActiveVersionNumber, ActiveVersionApiVersion, LatestVersionNumber, LatestVersionStatus, HasNewerDraft, DefinitionId, ActiveVersionId, LatestVersionId and VersionDataComplete. IsActive is true when the definition has an active version. An inactive flow has no ActiveVersionNumber or ActiveVersionApiVersion ($null, not 0). LatestVersionStatus is the status of the newest version as Salesforce reports it (Active, Draft, InvalidDraft or Obsolete). HasNewerDraft is true when the newest version is a draft that is not the active one. ProcessType (Flow, AutoLaunchedFlow, Workflow for record-triggered and process flows, and so on) comes from the active version, or from the latest version of an inactive flow. VersionDataComplete is false when a version the definition points to was not returned by the query; the values that would come from it are then $null. -ActiveOnly keeps only active flows. -Name keeps one flow by API name (ignoring case).

#### Parameters

- `-ActiveOnly` (switch): Optional switch. Return only flows that have an active version.
- `-Name` (String): Optional. The API name (DeveloperName) of one flow. The filter runs in PowerShell, after the query, and ignores case.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org. Passed to sf as --target-org.

#### Salesforce CLI

- `sf data query`

#### Examples

```powershell
PS> Get-SalesforceFlows -ActiveOnly -TargetOrg dev1 | Format-Table Name, ProcessType, ActiveVersionNumber, ActiveVersionApiVersion
```

The active flows, their active version and its API version.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceFlows -Examples"
- For more information, type: "Get-Help Get-SalesforceFlows -Detailed"
- For technical information, type: "Get-Help Get-SalesforceFlows -Full"
- For online help, type: "Get-Help Get-SalesforceFlows -Online"

#### Related Links

- <https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_flowdefinition.htm>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Source and tracking

### ConvertTo-SalesforceMetadataApiFormat

#### Synopsis

Converts Salesforce DX source files into Metadata API (mdapi) format.

#### Syntax

```powershell
ConvertTo-SalesforceMetadataApiFormat [[-RootDirectory] <String>] [[-SourceDirectory] <String[]>] [[-OutputDirectory] <String>] [[-Manifest] <String>] [[-Metadata] <String[]>] [[-PackageName] <String>] [<CommonParameters>]
```

#### Description

Runs sf project convert source. The source in the project (or in -RootDirectory or -SourceDirectory) is converted into the format that Metadata API deploys, and written to -OutputDirectory. Works on local files only; it does not touch an org.

#### Parameters

- `-RootDirectory` (String): Folder that holds the source files. Passed as --root-dir. The CLI uses the project package folders when omitted.
- `-SourceDirectory` (String[]): Source folders or files to convert. Each path must exist. Passed as one --source-dir per value.
- `-OutputDirectory` (String): Folder that receives the converted files. Passed as --output-dir.
- `-Manifest` (String): Path of a package.xml that selects what to convert. The file must exist. Passed as --manifest.
- `-Metadata` (String[]): Metadata components to convert, such as ApexClass:MyClass. Passed as one --metadata per value.
- `-PackageName` (String): Name of the package the converted files belong to. Passed as --package-name.

#### Salesforce CLI

- `sf project convert source`

#### Examples

```powershell
PS> ConvertTo-SalesforceMetadataApiFormat -SourceDirectory force-app -OutputDirectory .\mdapi
```

Convert force-app to Metadata API format.

#### Remarks

- To see the examples, type: "Get-Help ConvertTo-SalesforceMetadataApiFormat -Examples"
- For more information, type: "Get-Help ConvertTo-SalesforceMetadataApiFormat -Detailed"
- For technical information, type: "Get-Help ConvertTo-SalesforceMetadataApiFormat -Full"
- For online help, type: "Get-Help ConvertTo-SalesforceMetadataApiFormat -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### ConvertTo-SalesforceSourceFormat

#### Synopsis

Converts Metadata API (mdapi) files into the source format of a Salesforce DX project.

#### Syntax

```powershell
ConvertTo-SalesforceSourceFormat [-RootDirectory] <String> [[-OutputDirectory] <String>] [[-Manifest] <String>] [[-Metadata] <String[]>] [[-MetadataDirectory] <String[]>] [<CommonParameters>]
```

#### Description

Runs sf project convert mdapi. The files in -RootDirectory, which you retrieved as a package, are converted into source format and written to -OutputDirectory, or to the default package folder of the project. Use -Manifest, -Metadata or -MetadataDirectory to convert only part of them. Works on local files only; it does not touch an org.

#### Parameters

- `-RootDirectory` (String, required): Folder that holds the Metadata API files. It must exist. Passed as --root-dir. Required.
- `-OutputDirectory` (String): Folder that receives the source format files. Passed as --output-dir. The CLI uses the default package folder when omitted.
- `-Manifest` (String): Path of a package.xml that selects what to convert. The file must exist. Passed as --manifest.
- `-Metadata` (String[]): Metadata components to convert, such as ApexClass:MyClass. Passed as one --metadata per value.
- `-MetadataDirectory` (String[]): Folders inside -RootDirectory to convert. Passed as one --metadata-dir per value.

#### Salesforce CLI

- `sf project convert mdapi`

#### Examples

```powershell
PS> ConvertTo-SalesforceSourceFormat -RootDirectory .\retrieved -OutputDirectory force-app
```

Convert a retrieved package into source format.

#### Remarks

- To see the examples, type: "Get-Help ConvertTo-SalesforceSourceFormat -Examples"
- For more information, type: "Get-Help ConvertTo-SalesforceSourceFormat -Detailed"
- For technical information, type: "Get-Help ConvertTo-SalesforceSourceFormat -Full"
- For online help, type: "Get-Help ConvertTo-SalesforceSourceFormat -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Enable-SalesforceSourceBehavior

#### Synopsis

Turns on a beta source behavior, such as decomposed permission sets, and updates the project to use it (beta).

#### Syntax

```powershell
Enable-SalesforceSourceBehavior [-Behavior] <String> [-DryRun] [-PreserveTempDirectory] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project convert source-behavior, a beta command, so its name, flags and result can change in a later CLI release. It rewrites the source files of the project and adds the behavior to sfdx-project.json. Supports -WhatIf and -Confirm (no prompt by default). -DryRun asks the CLI to show what it would change and changes nothing, so it runs without confirmation.

#### Parameters

- `-Behavior` (String, required): The behavior to turn on. Valid values: decomposeCustomLabelsBeta2, decomposeCustomLabelsBeta, decomposePermissionSetBeta, decomposePermissionSetBeta2, decomposeSharingRulesBeta, decomposeWorkflowBeta, decomposeExternalServiceRegistrationBeta. Passed as --behavior. Required.
- `-DryRun` (switch): Show what would change without changing it. Adds --dry-run.
- `-PreserveTempDirectory` (switch): Keep the temporary folder the CLI uses during the conversion. Adds --preserve-temp-dir.
- `-TargetOrg` (String): Username or alias of the target org. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project convert source-behavior`

#### Examples

```powershell
PS> Enable-SalesforceSourceBehavior -Behavior decomposePermissionSetBeta2 -DryRun
```

See what the behavior would change.

#### Remarks

- To see the examples, type: "Get-Help Enable-SalesforceSourceBehavior -Examples"
- For more information, type: "Get-Help Enable-SalesforceSourceBehavior -Detailed"
- For technical information, type: "Get-Help Enable-SalesforceSourceBehavior -Full"
- For online help, type: "Get-Help Enable-SalesforceSourceBehavior -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceIgnoredFiles

#### Synopsis

Lists the files in the project package folders that .forceignore leaves out.

#### Syntax

```powershell
Get-SalesforceIgnoredFiles [[-SourceDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf project list ignored and returns one path per ignored file. Read-only. Use -SourceDirectory to check one folder instead of every package directory.

#### Parameters

- `-SourceDirectory` (String): Folder or file to check. It must exist. Passed as --source-dir. The CLI checks every package directory when omitted.

#### Salesforce CLI

- `sf project list ignored`

#### Examples

```powershell
PS> Get-SalesforceIgnoredFiles -SourceDirectory force-app/main/default/classes
```

Which class files does .forceignore skip.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceIgnoredFiles -Examples"
- For more information, type: "Get-Help Get-SalesforceIgnoredFiles -Detailed"
- For technical information, type: "Get-Help Get-SalesforceIgnoredFiles -Full"
- For online help, type: "Get-Help Get-SalesforceIgnoredFiles -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceSource

#### Synopsis

Deletes components from the org and from the local project.

#### Syntax

```powershell
Remove-SalesforceSource [[-SourceDirectory] <String[]>] [[-Metadata] <String[]>] [-CheckOnly] [-ForceOverwrite] [-TrackSource] [[-TestLevel] <String>] [[-Tests] <String[]>] [[-Wait] <Int32>] [-DetailedResults] [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project delete source. The named source files or metadata components are deleted from a org that does not use source tracking, and their files are deleted from the project. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. -CheckOnly validates the delete without making it, so it needs no confirmation. Give -SourceDirectory or -Metadata. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-SourceDirectory` (String[]): Source folders or files to delete. Each path must exist. Passed as one --source-dir per value.
- `-Metadata` (String[]): Metadata components to delete, such as ApexClass:MyClass. Passed as one --metadata per value.
- `-CheckOnly` (switch): Validate the delete, run any tests, and change nothing. Adds --check-only.
- `-ForceOverwrite` (switch): Delete even if it overwrites changes in a source-tracked org. Adds --force-overwrite.
- `-TrackSource` (switch): Update source tracking after the delete. Adds --track-source.
- `-TestLevel` (String): Apex testing level. Passed to sf as --test-level. Valid values: NoTests, SpecificTests, TestsInOrg, TestsInOrgAndPackages, RelevantTests. Value mapping to the CLI: NoTests = NoTestRun, SpecificTests = RunSpecifiedTests, TestsInOrg = RunLocalTests, TestsInOrgAndPackages = RunAllTestsInOrg, RelevantTests = RunRelevantTests. The CLI default applies when omitted.
- `-Tests` (String[]): Apex test classes to run with -TestLevel SpecificTests. Passed as one --tests per name.
- `-Wait` (Int32): Number of minutes to wait for the command to finish. Passed as --wait.
- `-DetailedResults` (switch): Show verbose output of the delete result. Adds --verbose.
- `-NoPrompt` (switch): Do not ask for confirmation. Use it in unattended scripts. -WhatIf still shows what would happen without deleting.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project delete source`

#### Examples

```powershell
PS> Remove-SalesforceSource -Metadata ApexClass:OldHelper -TargetOrg dev1 -WhatIf
```

Preview deleting one class from the org and the project.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceSource -Examples"
- For more information, type: "Get-Help Remove-SalesforceSource -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceSource -Full"
- For online help, type: "Get-Help Remove-SalesforceSource -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceSourceTracking

#### Synopsis

Deletes the local source tracking information of an org.

#### Syntax

```powershell
Remove-SalesforceSourceTracking [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project delete tracking. The local files that record what has changed between the project and the org are deleted; nothing in the org or in your source files changes, but the next deploy or retrieve cannot tell what changed. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-NoPrompt` (switch): Do not ask for confirmation. Use it in unattended scripts. -WhatIf still shows what would happen without deleting.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project delete tracking`

#### Examples

```powershell
PS> Remove-SalesforceSourceTracking -TargetOrg dev1 -WhatIf
```

Preview deleting the tracking files of dev1.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceSourceTracking -Examples"
- For more information, type: "Get-Help Remove-SalesforceSourceTracking -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceSourceTracking -Full"
- For online help, type: "Get-Help Remove-SalesforceSourceTracking -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Reset-SalesforceSourceTracking

#### Synopsis

Resets local and remote source tracking of an org to a revision.

#### Syntax

```powershell
Reset-SalesforceSourceTracking [[-Revision] <Int32>] [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project reset tracking. Source tracking is reset to the latest revision in the org, or to the revision number you give with -Revision. After a reset the next deploy or retrieve starts from that point, so changes made before it are no longer reported. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time.

#### Parameters

- `-Revision` (Int32): SourceMember revision number to reset to. Passed as --revision. The CLI uses the latest revision when omitted; 0 resets to the beginning.
- `-NoPrompt` (switch): Do not ask for confirmation. Use it in unattended scripts. -WhatIf still shows what would happen without resetting.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project reset tracking`

#### Examples

```powershell
PS> Reset-SalesforceSourceTracking -Revision 0 -TargetOrg my-scratch -WhatIf
```

Preview resetting tracking to the beginning.

#### Remarks

- To see the examples, type: "Get-Help Reset-SalesforceSourceTracking -Examples"
- For more information, type: "Get-Help Reset-SalesforceSourceTracking -Detailed"
- For technical information, type: "Get-Help Reset-SalesforceSourceTracking -Full"
- For online help, type: "Get-Help Reset-SalesforceSourceTracking -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Deployments

### Deploy-SalesforceComponent

#### Synopsis

Deploys one metadata component, or a source path, to an org.

#### Syntax

```powershell
Deploy-SalesforceComponent [[-Type] <String>] [[-Name] <String>] [[-SourceDirectory] <String>] [-IgnoreConflicts] [-IgnoreWarnings] [-IgnoreErrors] [[-Wait] <Int32>] [[-TestLevel] <String>] [[-Tests] <String[]>] [-Async] [[-CoverageFormatters] <String[]>] [-Junit] [[-ResultsDirectory] <String>] [-DryRun] [-ConciseResults] [-DetailedResults] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy start with --metadata Type:Name or --source-dir, with optional test level and tests. -DryRun adds --dry-run, which validates without deploying, so only a real deployment is confirmed. Supports -WhatIf and -Confirm (no prompt by default).

#### Parameters

- `-Type` (String): Metadata type, for example ApexClass or RecordType. Completes from the org's metadata types and the types the CLI lists; a type in neither gives a warning but is still passed. Needed unless -SourceDirectory is given. Passed to sf as --metadata.
- `-Name` (String): Name of the component. Needs -Type. Passed as --metadata Type:Name.
- `-SourceDirectory` (String): Path to the local source files to deploy. Passed to sf as --source-dir.
- `-IgnoreConflicts` (switch): Ignore conflicts and deploy local files, even if they overwrite changes in the org. Adds --ignore-conflicts.
- `-IgnoreWarnings` (switch): Ignore warnings and allow a deployment to complete successfully. Adds --ignore-warnings.
- `-IgnoreErrors` (switch): Ignore any errors and don't roll back deployment. Adds --ignore-errors.
- `-Wait` (Int32): Number of minutes to wait for command to complete and display results. Passed to sf as --wait.
- `-TestLevel` (String): How tests run. psfdx level names are translated to the CLI's (see the value mapping). Passed to sf as --test-level. Default: NoTests. Valid values: NoTests, SpecificTests, ReferencedTests, TestsInFolder, TestsInOrg, TestsInOrgAndPackages, RelevantTests. Value mapping to the CLI: NoTests = NoTestRun, SpecificTests = RunSpecifiedTests, ReferencedTests = RunSpecifiedTests, TestsInFolder = RunSpecifiedTests, TestsInOrg = RunLocalTests, TestsInOrgAndPackages = RunAllTestsInOrg, RelevantTests = RunRelevantTests. Production orgs reject NoTests (NoTestRun), so pass TestsInOrg, SpecificTests or another level when deploying to production. SpecificTests needs -Tests; ReferencedTests and TestsInFolder find the tests from -SourceDirectory.
- `-Tests` (String[]): Test classes to run for -TestLevel SpecificTests. Passed as one --tests per name.
- `-Async` (switch): Start the deployment and return without waiting for it (use Get-SalesforceDeployStatus or Resume-SalesforceDeploy later). Adds --async.
- `-CoverageFormatters` (String[]): Format of the code coverage results written to the results folder. Valid values: clover, cobertura, html-spa, html, json, json-summary, lcovonly, none, teamcity, text, text-summary. Passed as one --coverage-formatters per value.
- `-Junit` (switch): Also write JUnit test results. Adds --junit.
- `-ResultsDirectory` (String): Folder that receives the test and coverage results. Passed as --results-dir.
- `-DryRun` (switch): Validate only. Passed as --dry-run; nothing is deployed.
- `-ConciseResults` (switch): Show concise output of the deploy result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the deploy result. Adds --verbose.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy start`

#### Examples

```powershell
PS> Deploy-SalesforceComponent -Type ApexClass -Name AccountService -TargetOrg dev1 -WhatIf
```

Preview deploying one class.

#### Remarks

- To see the examples, type: "Get-Help Deploy-SalesforceComponent -Examples"
- For more information, type: "Get-Help Deploy-SalesforceComponent -Detailed"
- For technical information, type: "Get-Help Deploy-SalesforceComponent -Full"
- For online help, type: "Get-Help Deploy-SalesforceComponent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Deploy-SalesforceMetadata

#### Synopsis

Deploys metadata described by a manifest or a metadata folder.

#### Syntax

```powershell
Deploy-SalesforceMetadata [[-Manifest] <String>] [[-InputDirectory] <String>] [-ManifestPackage] [[-TargetOrg] <String>] [-IgnoreConflicts] [-IgnoreWarnings] [-IgnoreErrors] [[-PreDestructiveChanges] <String>] [[-PostDestructiveChanges] <String>] [-PurgeOnDelete] [-Async] [[-CoverageFormatters] <String[]>] [-Junit] [[-ResultsDirectory] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy start with --manifest, --metadata-dir or --single-package. Give exactly one of -Manifest, -InputDirectory and -ManifestPackage. Supports -WhatIf and -Confirm (no prompt by default).

#### Parameters

- `-Manifest` (String): Path of package.xml. Passed as --manifest.
- `-InputDirectory` (String): Folder of metadata in metadata (mdapi) format. Passed as --metadata-dir.
- `-ManifestPackage` (switch): Treat the metadata directory as a single package. Passed as --single-package.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-IgnoreConflicts` (switch): Ignore conflicts and deploy local files, even if they overwrite changes in the org. Adds --ignore-conflicts.
- `-IgnoreWarnings` (switch): Ignore warnings and allow a deployment to complete successfully. Adds --ignore-warnings.
- `-IgnoreErrors` (switch): Ignore any errors and don't roll back deployment. Adds --ignore-errors.
- `-PreDestructiveChanges` (String): Path of a destructiveChangesPre.xml file; the components it lists are deleted before the deploy. The file must exist. Passed as --pre-destructive-changes.
- `-PostDestructiveChanges` (String): Path of a destructiveChangesPost.xml file; the components it lists are deleted after the deploy. The file must exist. Passed as --post-destructive-changes.
- `-PurgeOnDelete` (switch): Delete the destructive-changes components permanently instead of keeping them in the Recycle Bin. Needs -PreDestructiveChanges or -PostDestructiveChanges. Adds --purge-on-delete.
- `-Async` (switch): Start the deployment and return without waiting for it (use Get-SalesforceDeployStatus or Resume-SalesforceDeploy later). Adds --async.
- `-CoverageFormatters` (String[]): Format of the code coverage results written to the results folder. Valid values: clover, cobertura, html-spa, html, json, json-summary, lcovonly, none, teamcity, text, text-summary. Passed as one --coverage-formatters per value.
- `-Junit` (switch): Also write JUnit test results. Adds --junit.
- `-ResultsDirectory` (String): Folder that receives the test and coverage results. Passed as --results-dir.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy start`

#### Examples

```powershell
PS> Deploy-SalesforceMetadata -Manifest manifest/package.xml -TargetOrg dev1 -WhatIf
```

Preview deploying a manifest.

#### Remarks

- To see the examples, type: "Get-Help Deploy-SalesforceMetadata -Examples"
- For more information, type: "Get-Help Deploy-SalesforceMetadata -Detailed"
- For technical information, type: "Get-Help Deploy-SalesforceMetadata -Full"
- For online help, type: "Get-Help Deploy-SalesforceMetadata -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDeployPreview

#### Synopsis

Shows what a deploy would send, and what conflicts with the org, without deploying (sf project deploy preview).

#### Syntax

```powershell
Get-SalesforceDeployPreview [[-SourceDirectory] <String[]>] [[-Manifest] <String>] [[-Metadata] <String[]>] [-IgnoreConflicts] [-ConciseResults] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Read-only: nothing is deployed, retrieved or deleted. Returns one object with ToDeploy, ToRetrieve, ToDelete, Conflicts and Ignored, plus HasChanges, HasConflicts and Summary. With no changes the lists are empty and Summary is 'No changes'. Source tracking is required: scratch orgs and tracked sandboxes work; other orgs return the CLI error with guidance. Narrow the preview with -SourceDirectory, -Manifest (one package.xml; the CLI accepts only one) or -Metadata (any combination the CLI accepts).

#### Parameters

- `-SourceDirectory` (String[]): Path to the local source files to preview. Passed to sf as --source-dir.
- `-Manifest` (String): Full file path for manifest (package.xml) of components to preview. Passed to sf as --manifest.
- `-Metadata` (String[]): Metadata component names to preview. Passed to sf as --metadata.
- `-IgnoreConflicts` (switch): Don't display conflicts in preview of the deployment. Adds --ignore-conflicts.
- `-ConciseResults` (switch): Show concise output. Adds --concise.
- `-TargetOrg` (String): 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 project deploy preview`

#### Examples

```powershell
PS> Get-SalesforceDeployPreview -TargetOrg my-sandbox
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDeployPreview -Examples"
- For more information, type: "Get-Help Get-SalesforceDeployPreview -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDeployPreview -Full"
- For online help, type: "Get-Help Get-SalesforceDeployPreview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDeployStatus

#### Synopsis

Reports the status of a deployment.

#### Syntax

```powershell
Get-SalesforceDeployStatus [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [[-TargetOrg] <String>] [[-CoverageFormatters] <String[]>] [-Junit] [[-ResultsDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf project deploy report for a job ID, or for the most recent deployment with -UseMostRecent. Give one of the two. With -Wait the CLI keeps polling.

#### Parameters

- `-JobId` (String): Job ID of the deploy operation you want to check the status of. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Report on the deployment the CLI started most recently. Use instead of -JobId.
- `-Wait` (Int32): Number of minutes to wait for command to complete and display results. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the target org. Passed to sf as --target-org.
- `-CoverageFormatters` (String[]): Format of the code coverage results written to the results folder. Valid values: clover, cobertura, html-spa, html, json, json-summary, lcovonly, none, teamcity, text, text-summary. Passed as one --coverage-formatters per value.
- `-Junit` (switch): Also write JUnit test results. Adds --junit.
- `-ResultsDirectory` (String): Folder that receives the test and coverage results. Passed as --results-dir.

#### Salesforce CLI

- `sf project deploy report`

#### Examples

```powershell
PS> Get-SalesforceDeployStatus -UseMostRecent -TargetOrg dev1
```

Status of the last deployment.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDeployStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceDeployStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDeployStatus -Full"
- For online help, type: "Get-Help Get-SalesforceDeployStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceDeploySummary

#### Synopsis

Summarises a deployment or validation in one flat object: status, counts, component failures, test failures and coverage gaps.

#### Syntax

```powershell
Get-SalesforceDeploySummary [-JobId <String>] [-UseMostRecent] [-Wait <Int32>] [-TargetOrg <String>] [<CommonParameters>]
Get-SalesforceDeploySummary -InputObject <PSObject> [<CommonParameters>]
```

#### Description

Runs sf project deploy report for a job ID, or the most recent job with -UseMostRecent, and returns one flat object: JobId, Status, Success, IsComplete, CheckOnly, TestLevel, RunTestsEnabled, StartDate, CompletedDate, ComponentsDeployed, ComponentErrors, ComponentsTotal, TestsCompleted, TestErrors, TestsTotal, ComponentFailures, TestFailures, CoverageWarnings, LowCoverage, ErrorMessage and Details. A failed deployment is summarised, not thrown: the CLI reports it with a non-zero status, and this cmdlet reads the deployment result from that report. It throws only when the report has no deployment result, for example when the job ID is unknown or the org is not authorized. ComponentFailures has ComponentType, FullName, FileName, LineNumber, ColumnNumber, ProblemType and Problem for each failed component. TestFailures has ClassName, MethodName, Message and StackTrace for each failed test. CoverageWarnings has Name and Message for each coverage warning the org reported. LowCoverage lists the classes and triggers in the test result's coverage below 75 percent, with Name, Type, LinesCovered, LinesNotCovered and CoveragePercent. IsComplete is false while the job is still queued or running; the counts are then the ones reported so far. TestLevel is filled only when the report includes one; the deployment result usually does not, so it is often $null (RunTestsEnabled says whether tests ran). Details is the CLI's complete deployment result, unchanged. You can also pipe in a result you already have, such as the output of Get-SalesforceDeployStatus; then no command runs.

#### Parameters

- `-JobId` (String): ID of the deployment or validation job (0Af...). Give this or -UseMostRecent. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Optional switch. Summarise the most recent deployment instead of a given job. Adds --use-most-recent.
- `-Wait` (Int32): Optional. Minutes for the CLI to wait for the job to finish before reporting. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-InputObject` (PSObject, required): A deployment result you already have (from the pipeline). When given, no command runs. Not a CLI flag.

#### Salesforce CLI

- `sf project deploy report`

#### Examples

```powershell
PS> Get-SalesforceDeploySummary -JobId 0Af000000000001AAA -TargetOrg prod
```

The status, failures and coverage gaps of one deployment.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceDeploySummary -Examples"
- For more information, type: "Get-Help Get-SalesforceDeploySummary -Detailed"
- For technical information, type: "Get-Help Get-SalesforceDeploySummary -Full"
- For online help, type: "Get-Help Get-SalesforceDeploySummary -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforceDeploy

#### Synopsis

Resumes watching a deployment that is still running.

#### Syntax

```powershell
Resume-SalesforceDeploy [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [-ConciseResults] [-DetailedResults] [[-CoverageFormatters] <String[]>] [-Junit] [[-ResultsDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf project deploy resume for a job ID, or the most recent one with -UseMostRecent. The CLI finds the org from its record of the job, so there is no -TargetOrg.

#### Parameters

- `-JobId` (String): Job ID of the deploy operation you want to resume. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Resume the deployment the CLI started most recently. Use instead of -JobId.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results. Passed to sf as --wait.
- `-ConciseResults` (switch): Show concise output of the deploy operation result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the deploy operation result. Adds --verbose.
- `-CoverageFormatters` (String[]): Format of the code coverage results written to the results folder. Valid values: clover, cobertura, html-spa, html, json, json-summary, lcovonly, none, teamcity, text, text-summary. Passed as one --coverage-formatters per value.
- `-Junit` (switch): Also write JUnit test results. Adds --junit.
- `-ResultsDirectory` (String): Folder that receives the test and coverage results. Passed as --results-dir.

#### Salesforce CLI

- `sf project deploy resume`

#### Examples

```powershell
PS> Resume-SalesforceDeploy -UseMostRecent -Wait 10
```

Wait up to ten more minutes for the last deployment.

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforceDeploy -Examples"
- For more information, type: "Get-Help Resume-SalesforceDeploy -Detailed"
- For technical information, type: "Get-Help Resume-SalesforceDeploy -Full"
- For online help, type: "Get-Help Resume-SalesforceDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Start-SalesforceQuickDeploy

#### Synopsis

Deploys a validated deployment without running the tests again.

#### Syntax

```powershell
Start-SalesforceQuickDeploy [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [-Async] [-ConciseResults] [-DetailedResults] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy quick for the validation job ID (or the most recent with -UseMostRecent). The validation must have passed recently. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-JobId` (String): Job ID of the deployment you want to quick deploy. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Use the validation the CLI ran most recently. Use instead of -JobId.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results. Passed to sf as --wait.
- `-Async` (switch): Run the command asynchronously. Adds --async.
- `-ConciseResults` (switch): Show concise output of the deploy result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the deploy result. Adds --verbose.
- `-TargetOrg` (String): Username or alias of the target org. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy quick`

#### Examples

```powershell
PS> Start-SalesforceQuickDeploy -JobId 0Af000000000001AAA -TargetOrg prod -WhatIf
```

Preview the quick deploy.

#### Remarks

- To see the examples, type: "Get-Help Start-SalesforceQuickDeploy -Examples"
- For more information, type: "Get-Help Start-SalesforceQuickDeploy -Detailed"
- For technical information, type: "Get-Help Start-SalesforceQuickDeploy -Full"
- For online help, type: "Get-Help Start-SalesforceQuickDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Stop-SalesforceDeploy

#### Synopsis

Cancels a deployment that is running.

#### Syntax

```powershell
Stop-SalesforceDeploy [[-JobId] <String>] [-UseMostRecent] [[-Wait] <Int32>] [-Async] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf project deploy cancel for a job ID or the most recent one. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-JobId` (String): Job ID of the deploy operation you want to cancel. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Cancel the deployment the CLI started most recently. Use instead of -JobId.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results. Passed to sf as --wait.
- `-Async` (switch): Run the command asynchronously. Adds --async.
- `-TargetOrg` (String): Username or alias of the target org. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf project deploy cancel`

#### Examples

```powershell
PS> Stop-SalesforceDeploy -UseMostRecent -TargetOrg dev1 -WhatIf
```

Preview the cancel.

#### Remarks

- To see the examples, type: "Get-Help Stop-SalesforceDeploy -Examples"
- For more information, type: "Get-Help Stop-SalesforceDeploy -Detailed"
- For technical information, type: "Get-Help Stop-SalesforceDeploy -Full"
- For online help, type: "Get-Help Stop-SalesforceDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforceDeploy

#### Synopsis

Validates a deployment, running tests, without deploying it.

#### Syntax

```powershell
Test-SalesforceDeploy [[-Manifest] <String>] [[-SourceDirectory] <String>] [[-InputDirectory] <String>] [[-Metadata] <String[]>] [[-PreDestructiveChanges] <String>] [[-PostDestructiveChanges] <String>] [-PurgeOnDelete] [[-CoverageFormatters] <String[]>] [-Junit] [[-ResultsDirectory] <String>] [-ManifestPackage] [[-TestLevel] <String>] [[-Tests] <String[]>] [-IgnoreWarnings] [[-Wait] <Int32>] [-Async] [-ConciseResults] [-DetailedResults] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf project deploy validate. Nothing is deployed; a passing validation can be released later with Start-SalesforceQuickDeploy. The test level must run tests (NoTests is not offered).

#### Parameters

- `-Manifest` (String): Full file path for manifest (package.xml) of components to validate for deployment. Passed to sf as --manifest.
- `-SourceDirectory` (String): Path to the local source files to validate for deployment. Passed to sf as --source-dir.
- `-InputDirectory` (String): Root of directory or zip file of metadata formatted files to deploy. Passed to sf as --metadata-dir.
- `-Metadata` (String[]): Metadata components to validate, such as ApexClass:MyClass. Use instead of -Manifest, -SourceDirectory and -InputDirectory. Passed as one --metadata per value.
- `-PreDestructiveChanges` (String): Path of a destructiveChangesPre.xml file; the components it lists are deleted before the deploy. The file must exist. Passed as --pre-destructive-changes.
- `-PostDestructiveChanges` (String): Path of a destructiveChangesPost.xml file; the components it lists are deleted after the deploy. The file must exist. Passed as --post-destructive-changes.
- `-PurgeOnDelete` (switch): Delete the destructive-changes components permanently instead of keeping them in the Recycle Bin. Needs -PreDestructiveChanges or -PostDestructiveChanges. Adds --purge-on-delete.
- `-CoverageFormatters` (String[]): Format of the code coverage results written to the results folder. Valid values: clover, cobertura, html-spa, html, json, json-summary, lcovonly, none, teamcity, text, text-summary. Passed as one --coverage-formatters per value.
- `-Junit` (switch): Also write JUnit test results. Adds --junit.
- `-ResultsDirectory` (String): Folder that receives the test and coverage results. Passed as --results-dir.
- `-ManifestPackage` (switch): Indicates that the metadata zip file points to a directory structure for a single package. Adds --single-package.
- `-TestLevel` (String): Deployment Apex testing level. Passed to sf as --test-level. Default: TestsInOrg. Valid values: SpecificTests, ReferencedTests, TestsInFolder, TestsInOrg, TestsInOrgAndPackages, RelevantTests. NoTests is not offered, because a validation is a check that tests pass. Value mapping to the CLI: SpecificTests = RunSpecifiedTests, ReferencedTests = RunSpecifiedTests, TestsInFolder = RunSpecifiedTests, TestsInOrg = RunLocalTests, TestsInOrgAndPackages = RunAllTestsInOrg, RelevantTests = RunRelevantTests.
- `-Tests` (String[]): Apex test classes to run with -TestLevel SpecificTests. Passed as one --tests per name.
- `-IgnoreWarnings` (switch): Ignore warnings and allow a deployment to complete successfully. Adds --ignore-warnings.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results. Passed to sf as --wait.
- `-Async` (switch): Run the command asynchronously. Adds --async.
- `-ConciseResults` (switch): Show concise output of the validation result. Adds --concise.
- `-DetailedResults` (switch): Show verbose output of the validation result. Adds --verbose.
- `-TargetOrg` (String): 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 project deploy validate`

#### Examples

```powershell
PS> Test-SalesforceDeploy -SourceDirectory force-app -TestLevel TestsInOrg -TargetOrg prod
```

Validate against production with all local tests.

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforceDeploy -Examples"
- For more information, type: "Get-Help Test-SalesforceDeploy -Detailed"
- For technical information, type: "Get-Help Test-SalesforceDeploy -Full"
- For online help, type: "Get-Help Test-SalesforceDeploy -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Retrieval

### Get-SalesforceRetrievePreview

#### Synopsis

Shows what a retrieve would bring down, and what conflicts with local files, without retrieving (sf project retrieve preview).

#### Syntax

```powershell
Get-SalesforceRetrievePreview [-IgnoreConflicts] [-ConciseResults] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Read-only: nothing is retrieved or changed. Returns the same object as Get-SalesforceDeployPreview. The CLI command takes no selection flags, so it previews the org's tracked changes. Source tracking is required (see Get-SalesforceDeployPreview).

#### Parameters

- `-IgnoreConflicts` (switch): Don't display conflicts in the preview of the retrieval. Adds --ignore-conflicts.
- `-ConciseResults` (switch): Show concise output. Adds --concise.
- `-TargetOrg` (String): 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 project retrieve preview`

#### Examples

```powershell
PS> Get-SalesforceRetrievePreview -TargetOrg my-scratch
```

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceRetrievePreview -Examples"
- For more information, type: "Get-Help Get-SalesforceRetrievePreview -Detailed"
- For technical information, type: "Get-Help Get-SalesforceRetrievePreview -Full"
- For online help, type: "Get-Help Get-SalesforceRetrievePreview -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforceComponent

#### Synopsis

Retrieves one metadata component from an org.

#### Syntax

```powershell
Retrieve-SalesforceComponent [[-Type] <String>] [[-Name] <String>] [[-ChildName] <String>] [[-SourceDirectory] <String[]>] [[-RootTypeWithDependencies] <String[]>] [[-TargetOrg] <String>] [[-Wait] <Int32>] [[-OutputDirectory] <String>] [-IgnoreConflicts] [<CommonParameters>]
```

#### Description

Runs sf project retrieve start with --metadata Type, Type:Name or Type:Name.ChildName, or with -SourceDirectory, and returns the CLI's result as an object: status, success, done, the retrieved files (fullName, type, state and filePath of each) and any messages. The type completes from the org's metadata types and the types the CLI lists; a type in neither gives a warning but is still passed to sf. A failed retrieve throws with the CLI's message.

It must run inside a Salesforce DX project, because the CLI writes the files into the project's package directories. If there is no sfdx-project.json in the current folder or any parent folder, it throws before calling the CLI and says how to fix it: change to a project folder, create one with New-SalesforceProject, or use Retrieve-SalesforceMetadata with a package.xml manifest, which needs no project.

#### Parameters

- `-Type` (String): Metadata type, for example ApexClass or CustomField. Required unless you give -SourceDirectory; completes from the org's metadata types and the types the CLI lists, and warns (without stopping) for a type in neither.
- `-Name` (String): Name of the component, for example an object name for a field. Together with -Type it forms --metadata Type:Name.
- `-ChildName` (String): Metadata component names to retrieve. Wildcards (`*`) supported as long as you use quotes, such as `ApexClass:MyClass*`. Passed to sf as --metadata.
- `-SourceDirectory` (String[]): Local source folders or files whose components are retrieved from the org. Each path must exist. Use instead of -Type. Passed as one --source-dir per value.
- `-RootTypeWithDependencies` (String[]): Metadata types to retrieve together with the components they depend on. Valid values: Bot, AiAgentDefinitionVersion. Passed as one --root-type-with-dependencies per value.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results to the terminal window. Passed to sf as --wait.
- `-OutputDirectory` (String): Directory root for the retrieved source files. Passed to sf as --output-dir.
- `-IgnoreConflicts` (switch): Ignore conflicts and retrieve and save files to your local filesystem, even if they overwrite your local changes. Adds --ignore-conflicts.

#### Salesforce CLI

- `sf project retrieve start`

#### Examples

```powershell
PS> Retrieve-SalesforceComponent -Type ApexClass -Name AccountService -TargetOrg dev1
```

Retrieve one class into the project.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforceComponent -Examples"
- For more information, type: "Get-Help Retrieve-SalesforceComponent -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforceComponent -Full"
- For online help, type: "Get-Help Retrieve-SalesforceComponent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforceField

#### Synopsis

Retrieves one custom field into the project.

#### Syntax

```powershell
Retrieve-SalesforceField [-ObjectName] <String> [-FieldName] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

A shortcut for Retrieve-SalesforceComponent -Type CustomField with the object as the name and the field as the child name.

#### Parameters

- `-ObjectName` (String, required): API name of the object that holds the field. Required.
- `-FieldName` (String, required): API name of the field, for example Rating__c. Required.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Retrieve-SalesforceField -ObjectName Account -FieldName Rating__c -TargetOrg dev1
```

Retrieve Account.Rating__c.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforceField -Examples"
- For more information, type: "Get-Help Retrieve-SalesforceField -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforceField -Full"
- For online help, type: "Get-Help Retrieve-SalesforceField -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforceMetadata

#### Synopsis

Retrieves the metadata a manifest lists, as a package, into a folder.

#### Syntax

```powershell
Retrieve-SalesforceMetadata [-Manifest] <String> [-OutputDirectory] <String> [[-Wait] <Int32>] [-Unzip] [-SinglePackage] [[-ZipFileName] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf project retrieve start with --manifest and --target-metadata-dir, optionally unzipped. Both the manifest file and the output folder must exist.

#### Parameters

- `-Manifest` (String, required): File path for the manifest (package.xml) that specifies the components to retrieve. Passed to sf as --manifest. Required.
- `-OutputDirectory` (String, required): Folder that receives the retrieved package. Passed as --target-metadata-dir. Required.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results to the terminal window. Passed to sf as --wait.
- `-Unzip` (switch): Extract the retrieved zip. Passed as --unzip.
- `-SinglePackage` (switch): Treat the manifest as a single package (the retrieved zip holds one package folder). Adds --single-package.
- `-ZipFileName` (String): File name of the retrieved zip. Passed as --zip-file-name. The CLI uses unpackaged.zip when omitted.
- `-TargetOrg` (String): 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 project retrieve start`

#### Examples

```powershell
PS> Retrieve-SalesforceMetadata -Manifest manifest/package.xml -OutputDirectory .\retrieved -Unzip -TargetOrg dev1
```

Retrieve and unzip.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforceMetadata -Examples"
- For more information, type: "Get-Help Retrieve-SalesforceMetadata -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforceMetadata -Full"
- For online help, type: "Get-Help Retrieve-SalesforceMetadata -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforceOrg

#### Synopsis

Retrieves all the metadata of an org into the project.

#### Syntax

```powershell
Retrieve-SalesforceOrg [[-TargetOrg] <String>] [-IncludePackages] [<CommonParameters>]
```

#### Description

Runs two commands. First sf project generate manifest --from-org --name=allMetadata --output-dir . writes allMetadata.xml in the current folder; then sf project retrieve start --manifest allMetadata.xml retrieves everything it lists. This can take a long time on a large org.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org to retrieve from. Passed as --from-org to sf project generate manifest and as --target-org to sf project retrieve start. If omitted, the CLI uses the default target org.
- `-IncludePackages` (switch): Also include the org's unlocked package contents. psfdx passes --include-packages=unlocked. Use New-SalesforceManifest for managed packages.

#### Salesforce CLI

- `sf project generate manifest`
- `sf project retrieve start`

#### Examples

```powershell
PS> Retrieve-SalesforceOrg -TargetOrg dev1
```

Write allMetadata.xml and retrieve all metadata.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforceOrg -Examples"
- For more information, type: "Get-Help Retrieve-SalesforceOrg -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforceOrg -Full"
- For online help, type: "Get-Help Retrieve-SalesforceOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforcePackage

#### Synopsis

Retrieves a package's metadata into a folder.

#### Syntax

```powershell
Retrieve-SalesforcePackage [-Name] <String> [-OutputDirectory] <String> [[-Wait] <Int32>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf project retrieve start with --package-name and --output-dir. The output folder must exist.

#### Parameters

- `-Name` (String, required): Name of the package to retrieve. Passed as --package-name. Required.
- `-OutputDirectory` (String, required): Directory root for the retrieved source files. Passed to sf as --output-dir. Required.
- `-Wait` (Int32): Number of minutes to wait for the command to complete and display results to the terminal window. Passed to sf as --wait.
- `-TargetOrg` (String): 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 project retrieve start`

#### Examples

```powershell
PS> Retrieve-SalesforcePackage -Name MyPackage -OutputDirectory .\pkg -TargetOrg dev1
```

Retrieve one package.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforcePackage -Examples"
- For more information, type: "Get-Help Retrieve-SalesforcePackage -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforcePackage -Full"
- For online help, type: "Get-Help Retrieve-SalesforcePackage -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Retrieve-SalesforceValidationRule

#### Synopsis

Retrieves one validation rule into the project.

#### Syntax

```powershell
Retrieve-SalesforceValidationRule [-ObjectName] <String> [-RuleName] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

A shortcut for Retrieve-SalesforceComponent -Type ValidationRule with the object and rule name combined.

#### Parameters

- `-ObjectName` (String, required): API name of the object that holds the rule. Required.
- `-RuleName` (String, required): Name of the validation rule. Required.
- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Retrieve-SalesforceValidationRule -ObjectName Account -RuleName Require_Name -TargetOrg dev1
```

Retrieve one rule.

#### Remarks

- To see the examples, type: "Get-Help Retrieve-SalesforceValidationRule -Examples"
- For more information, type: "Get-Help Retrieve-SalesforceValidationRule -Detailed"
- For technical information, type: "Get-Help Retrieve-SalesforceValidationRule -Full"
- For online help, type: "Get-Help Retrieve-SalesforceValidationRule -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Metadata generation

### New-SalesforceCustomField

#### Synopsis

Creates the source files of a new custom field on an object in the project, asking questions.

#### Syntax

```powershell
New-SalesforceCustomField [-Label] <String> [[-ObjectDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf schema generate field, which writes the metadata file of a custom field on a standard or custom object. The object's source files must already be in the project (retrieve them first if they are not). It is interactive: it asks you questions (the API name, plural label, field type and so on, with suggestions based on the label), so it needs a terminal and a Salesforce DX project folder. Run it as a plain command. If you assign its output to a variable or pipe it, PowerShell captures the output and you cannot see the questions. It returns nothing; the files it writes are the result.

#### Parameters

- `-Label` (String, required): Label of the field, for example Invoice Total. The command suggests the API name from it. Passed to sf as --label. Required.
- `-ObjectDirectory` (String): Folder that holds the object's source files, for example force-app/main/default/objects/Invoice__c. If you leave it out the command asks for the object. The folder must exist. Passed to sf as --object.

#### Salesforce CLI

- `sf schema generate field`

#### Examples

```powershell
PS> New-SalesforceCustomField -Label 'Invoice Total' -ObjectDirectory force-app/main/default/objects/Invoice__c
```

Add a field to the Invoice object and answer the questions about its type.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomField -Examples"
- For more information, type: "Get-Help New-SalesforceCustomField -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomField -Full"
- For online help, type: "Get-Help New-SalesforceCustomField -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-sobject>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomMetadataField

#### Synopsis

Creates the file of a new field of a custom metadata type.

#### Syntax

```powershell
New-SalesforceCustomMetadataField [-Name] <String> [-Type] <String> [[-Label] <String>] [[-DecimalPlaces] <Int32>] [[-PicklistValues] <String[]>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf cmdt generate field, which writes a field definition file. Point -OutputDirectory at the type's folder, for example force-app/main/default/objects/MyCmdt__mdt, so the file lands in its fields folder. It works on local files and needs no org. A Picklist field needs -PicklistValues; -DecimalPlaces is for Number and Percent fields.

#### Parameters

- `-Name` (String, required): Unique API name of the field, without the __c suffix. Letters, digits and underscores only. Passed to sf as --name. Required.
- `-Type` (String, required): Type of the field. Valid values: Checkbox, Date, DateTime, Email, Number, Percent, Phone, Picklist, Text, TextArea, LongTextArea, Url. Passed to sf as --type. Required.
- `-Label` (String): Label of the field. By default the CLI uses the name. Passed to sf as --label.
- `-DecimalPlaces` (Int32): Number of decimal places, for a Number or Percent field. Passed to sf as --decimal-places.
- `-PicklistValues` (String[]): Values of a Picklist field. Each value is passed as its own --picklist-values. Required for a Picklist field. Passed to sf as --picklist-values.
- `-OutputDirectory` (String): Folder to write the field definition to. By default the CLI writes to a fields folder in the current folder. Passed to sf as --output-directory.

#### Salesforce CLI

- `sf cmdt generate field`

#### Examples

```powershell
PS> New-SalesforceCustomMetadataField -Name Mode -Type Picklist -PicklistValues On, Off, Auto -OutputDirectory force-app/main/default/objects/Feature_Flag__mdt
```

Add a picklist field to a type.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomMetadataField -Examples"
- For more information, type: "Get-Help New-SalesforceCustomMetadataField -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomMetadataField -Full"
- For online help, type: "Get-Help New-SalesforceCustomMetadataField -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-custom-metadata>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomMetadataRecord

#### Synopsis

Creates the file of a new record of a custom metadata type.

#### Syntax

```powershell
New-SalesforceCustomMetadataRecord [-TypeName] <String> [-RecordName] <String> [[-Label] <String>] [-Protected] [[-Values] <IDictionary>] [[-InputDirectory] <String>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf cmdt generate record, which writes a record file. The type must already be in the project (-InputDirectory says where to read its definition from). Give the field values as a hashtable in -Values, for example @{ Color__c = 'Red'; Size__c = 32 }; each pair is passed to the CLI as Field=Value. It works on local files and needs no org.

#### Parameters

- `-TypeName` (String, required): API name of the custom metadata type. The CLI needs the __mdt suffix, for example MyCmdt__mdt. Passed to sf as --type-name. Required.
- `-RecordName` (String, required): Name of the new record. Passed to sf as --record-name. Required.
- `-Label` (String): Label of the record. By default the CLI uses the record name. Passed to sf as --label.
- `-Protected` (switch): Protect the record when it is in a managed package. The switch sends the value true; without it the CLI default, false, applies. Passed to sf as --protected.
- `-Values` (IDictionary): Field values as field name and value pairs. Field names are checked; a value may not contain a double quote or a line break. Each pair is passed to sf as Field=Value.
- `-InputDirectory` (String): Folder to read the type definition from. The CLI default is force-app/main/default/objects. The folder must exist. Passed to sf as --input-directory.
- `-OutputDirectory` (String): Folder to write the record to. The CLI default is force-app/main/default/customMetadata. Passed to sf as --output-directory.

#### Salesforce CLI

- `sf cmdt generate record`

#### Examples

```powershell
PS> New-SalesforceCustomMetadataRecord -TypeName Feature_Flag__mdt -RecordName Checkout -Label 'Checkout' -Values @{ Mode__c = 'On'; Threshold__c = 2.5 }
```

Create a record with two field values.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomMetadataRecord -Examples"
- For more information, type: "Get-Help New-SalesforceCustomMetadataRecord -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomMetadataRecord -Full"
- For online help, type: "Get-Help New-SalesforceCustomMetadataRecord -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-custom-metadata>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomMetadataRecordsFromCsv

#### Synopsis

Creates custom metadata record files from the rows of a CSV file.

#### Syntax

```powershell
New-SalesforceCustomMetadataRecordsFromCsv [-Csv] <String> [-TypeName] <String> [[-NameColumn] <String>] [[-InputDirectory] <String>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf cmdt generate records, which writes one record file per CSV row. The type must already be in the project. The Name column gives each record its name unless you pick another with -NameColumn; the other columns are field names. It returns one object per record. It works on local files and needs no org.

#### Parameters

- `-Csv` (String, required): Path of the CSV file. The file must exist. Passed to sf as --csv. Required.
- `-TypeName` (String, required): API name of the custom metadata type. The CLI adds the __mdt suffix when it is left off. Passed to sf as --type-name. Required.
- `-NameColumn` (String): CSV column that gives each record its name. The CLI default is Name. Passed to sf as --name-column.
- `-InputDirectory` (String): Folder to read the type definition from. The CLI default is force-app/main/default/objects. The folder must exist. Passed to sf as --input-directory.
- `-OutputDirectory` (String): Folder to write the records to. The CLI default is force-app/main/default/customMetadata. Passed to sf as --output-directory.

#### Salesforce CLI

- `sf cmdt generate records`

#### Examples

```powershell
PS> New-SalesforceCustomMetadataRecordsFromCsv -Csv .\flags.csv -TypeName Feature_Flag -NameColumn Key
```

One record per row, named from the Key column.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomMetadataRecordsFromCsv -Examples"
- For more information, type: "Get-Help New-SalesforceCustomMetadataRecordsFromCsv -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomMetadataRecordsFromCsv -Full"
- For online help, type: "Get-Help New-SalesforceCustomMetadataRecordsFromCsv -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-custom-metadata>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomMetadataType

#### Synopsis

Creates the files of a new custom metadata type in the project.

#### Syntax

```powershell
New-SalesforceCustomMetadataType [-TypeName] <String> [[-Label] <String>] [[-PluralLabel] <String>] [[-Visibility] <String>] [[-OutputDirectory] <String>] [<CommonParameters>]
```

#### Description

Runs sf cmdt generate object, which writes the metadata file of a custom metadata type under a folder named &lt;TypeName&gt;__mdt. It works on local files and needs no org; run it inside a Salesforce DX project. Add fields with New-SalesforceCustomMetadataField and records with New-SalesforceCustomMetadataRecord. The result lists the type name, label, plural label and visibility.

#### Parameters

- `-TypeName` (String, required): Unique API name of the custom metadata type, without the __mdt suffix, for example MyCustomType. Letters, digits and underscores only. Passed to sf as --type-name. Required.
- `-Label` (String): Label of the type. By default the CLI uses the type name. Passed to sf as --label.
- `-PluralLabel` (String): Plural form of the label. By default the CLI uses the label. Passed to sf as --plural-label.
- `-Visibility` (String): Who can see the type. Valid values: PackageProtected, Protected, Public. The CLI default is Public. Passed to sf as --visibility.
- `-OutputDirectory` (String): Folder to write the type to, for example force-app/main/default/objects. By default the CLI writes to a &lt;TypeName&gt;__mdt folder in the current folder. Passed to sf as --output-directory.

#### Salesforce CLI

- `sf cmdt generate object`

#### Examples

```powershell
PS> New-SalesforceCustomMetadataType -TypeName Feature_Flag -Label 'Feature Flag' -PluralLabel 'Feature Flags' -Visibility Protected -OutputDirectory force-app/main/default/objects
```

Create a protected type in the project's objects folder.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomMetadataType -Examples"
- For more information, type: "Get-Help New-SalesforceCustomMetadataType -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomMetadataType -Full"
- For online help, type: "Get-Help New-SalesforceCustomMetadataType -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-custom-metadata>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomMetadataTypeFromOrg

#### Synopsis

Creates a custom metadata type, and a record for every row, from an object in an org.

#### Syntax

```powershell
New-SalesforceCustomMetadataTypeFromOrg [-DevName] <String> [-SObject] <String> [[-Label] <String>] [[-PluralLabel] <String>] [[-Visibility] <String>] [-IgnoreUnsupported] [[-TypeOutputDirectory] <String>] [[-RecordsOutputDirectory] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf cmdt generate fromorg. It reads the fields and the records of a custom object or custom setting in the org and writes a custom metadata type with those fields and one record per row into the project, so you can move the data to custom metadata. A field of a type that custom metadata does not support becomes a text field, unless you pass -IgnoreUnsupported. Only local files are written; nothing in the org changes.

#### Parameters

- `-DevName` (String, required): API name for the new custom metadata type, without the __mdt suffix. Passed to sf as --dev-name. Required.
- `-SObject` (String, required): API name of the object in the org to copy, for example My_Settings__c. Passed to sf as --sobject. Required.
- `-Label` (String): Label of the type. By default the CLI uses the name. Passed to sf as --label.
- `-PluralLabel` (String): Plural form of the label. By default the CLI uses the label. Passed to sf as --plural-label.
- `-Visibility` (String): Who can see the type. Valid values: PackageProtected, Protected, Public. The CLI default is Public. Passed to sf as --visibility.
- `-IgnoreUnsupported` (switch): Leave out fields of an unsupported type instead of turning them into text fields. Adds --ignore-unsupported.
- `-TypeOutputDirectory` (String): Folder to write the type to. The CLI default is force-app/main/default/objects. Passed to sf as --type-output-directory.
- `-RecordsOutputDirectory` (String): Folder to write the records to. The CLI default is force-app/main/default/customMetadata. Passed to sf as --records-output-dir.
- `-TargetOrg` (String): 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 cmdt generate fromorg`

#### Examples

```powershell
PS> New-SalesforceCustomMetadataTypeFromOrg -DevName App_Config -SObject App_Config__c -IgnoreUnsupported -TargetOrg dev1
```

Turn the App_Config__c custom setting into a custom metadata type.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomMetadataTypeFromOrg -Examples"
- For more information, type: "Get-Help New-SalesforceCustomMetadataTypeFromOrg -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomMetadataTypeFromOrg -Full"
- For online help, type: "Get-Help New-SalesforceCustomMetadataTypeFromOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-custom-metadata>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomObject

#### Synopsis

Creates the source files of a new custom object in the project, asking questions.

#### Syntax

```powershell
New-SalesforceCustomObject [-Label] <String> [-UseDefaultFeatures] [<CommonParameters>]
```

#### Description

Runs sf schema generate sobject, which writes the metadata files of a custom object, with its Name field. It is interactive: it asks you questions (the API name, plural label, field type and so on, with suggestions based on the label), so it needs a terminal and a Salesforce DX project folder. Run it as a plain command. If you assign its output to a variable or pipe it, PowerShell captures the output and you cannot see the questions. It returns nothing; the files it writes are the result. Use -UseDefaultFeatures to switch on the optional features, such as reports and search, without being asked about each. To add fields afterwards use New-SalesforceCustomField.

#### Parameters

- `-Label` (String, required): Label of the custom object, for example My Object. The command suggests the API name and plural label from it. Passed to sf as --label. Required.
- `-UseDefaultFeatures` (switch): Turn on all the optional object features without asking. Adds --use-default-features.

#### Salesforce CLI

- `sf schema generate sobject`

#### Examples

```powershell
PS> New-SalesforceCustomObject -Label 'Invoice' -UseDefaultFeatures
```

Create the Invoice object and answer the rest of the questions at the prompt.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomObject -Examples"
- For more information, type: "Get-Help New-SalesforceCustomObject -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomObject -Full"
- For online help, type: "Get-Help New-SalesforceCustomObject -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-sobject>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceCustomTab

#### Synopsis

Creates the source file of a new custom tab for a custom object.

#### Syntax

```powershell
New-SalesforceCustomTab [-ObjectName] <String> [-Directory] <String> [[-Icon] <Int32>] [<CommonParameters>]
```

#### Description

Runs sf schema generate tab, which writes a custom tab file. Unlike the other schema generators it asks no questions: everything comes from the parameters. Run it inside a Salesforce DX project. The custom object's own source files do not have to be in the project. It returns the CLI result as an object.

#### Parameters

- `-ObjectName` (String, required): API name of the custom object the tab is for, for example Invoice__c. Letters, digits and underscores only. Passed to sf as --object. Required.
- `-Directory` (String, required): Path of the tabs folder that will hold the tab file, for example force-app/main/default/tabs. The folder must already exist; the CLI does not create it. Passed to sf as --directory. Required.
- `-Icon` (Int32): Number from 1 to 100 that picks the tab's color scheme and icon. The CLI default is 1, which is also used here. Passed to sf as --icon.

#### Salesforce CLI

- `sf schema generate tab`

#### Examples

```powershell
PS> New-SalesforceCustomTab -ObjectName Invoice__c -Directory force-app/main/default/tabs -Icon 54
```

Create a tab for the Invoice object with icon 54.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceCustomTab -Examples"
- For more information, type: "Get-Help New-SalesforceCustomTab -Detailed"
- For technical information, type: "Get-Help New-SalesforceCustomTab -Full"
- For online help, type: "Get-Help New-SalesforceCustomTab -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-sobject>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceManifest

#### Synopsis

Writes a package.xml manifest from metadata names, local source or an org.

#### Syntax

```powershell
New-SalesforceManifest [[-Metadata] <String[]>] [[-ExcludedMetadata] <String[]>] [[-SourceDirectory] <String[]>] [[-FromOrg] <String>] [[-IncludePackages] <String[]>] [[-Name] <String>] [[-OutputDirectory] <String>] [[-Type] <String>] [<CommonParameters>]
```

#### Description

Runs sf project generate manifest and returns the CLI result (the path of the manifest written). Build the manifest from -Metadata names, from -SourceDirectory files, or from the metadata of an org with -FromOrg. Use -Type to write a destructive-changes or package manifest instead of package.xml. The output folder must already exist.

#### Parameters

- `-Metadata` (String[]): Metadata components to put in the manifest, such as ApexClass:MyClass. Passed as one --metadata per value.
- `-ExcludedMetadata` (String[]): Metadata types to leave out of a manifest built with -FromOrg. Passed as one --excluded-metadata per value.
- `-SourceDirectory` (String[]): Local source folders or files to build the manifest from. Passed as one --source-dir per value. Each path must exist.
- `-FromOrg` (String): Username or alias of an org to build the manifest from. Passed as --from-org.
- `-IncludePackages` (String[]): Also include the contents of managed or unlocked packages when building from an org. Valid values: managed, unlocked. Passed as one --include-packages per value.
- `-Name` (String): File name of the manifest, without the .xml extension. Passed as --name. The CLI chooses a name from -Type when omitted.
- `-OutputDirectory` (String): Folder that receives the manifest. It must exist. Passed as --output-dir.
- `-Type` (String): Kind of manifest to write. Valid values: pre, post, destroy, package. Passed as --type.

#### Salesforce CLI

- `sf project generate manifest`

#### Examples

```powershell
PS> New-SalesforceManifest -SourceDirectory force-app -Name package -OutputDirectory manifest
```

Write manifest/package.xml for everything in force-app.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceManifest -Examples"
- For more information, type: "Get-Help New-SalesforceManifest -Detailed"
- For technical information, type: "Get-Help New-SalesforceManifest -Full"
- For online help, type: "Get-Help New-SalesforceManifest -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-deploy-retrieve>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforcePlatformEvent

#### Synopsis

Creates the source files of a new platform event in the project, asking questions.

#### Syntax

```powershell
New-SalesforcePlatformEvent [-Label] <String> [<CommonParameters>]
```

#### Description

Runs sf schema generate platformevent, which writes the metadata file of a platform event. It is interactive: it asks you questions (the API name, plural label, field type and so on, with suggestions based on the label), so it needs a terminal and a Salesforce DX project folder. Run it as a plain command. If you assign its output to a variable or pipe it, PowerShell captures the output and you cannot see the questions. It returns nothing; the files it writes are the result.

#### Parameters

- `-Label` (String, required): Label of the platform event, for example Order Shipped. The command suggests the API name from it. Passed to sf as --label. Required.

#### Salesforce CLI

- `sf schema generate platformevent`

#### Examples

```powershell
PS> New-SalesforcePlatformEvent -Label 'Order Shipped'
```

Create the platform event and answer the rest of the questions at the prompt.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforcePlatformEvent -Examples"
- For more information, type: "Get-Help New-SalesforcePlatformEvent -Detailed"
- For technical information, type: "Get-Help New-SalesforcePlatformEvent -Full"
- For online help, type: "Get-Help New-SalesforcePlatformEvent -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-sobject>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-org command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-org/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

12 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**Sandboxes**: [Copy-SalesforceSandbox](#copy-salesforcesandbox), [Get-SalesforceSandboxes](#get-salesforcesandboxes), [Get-SalesforceSandboxRefreshStatus](#get-salesforcesandboxrefreshstatus), [New-SalesforceSandbox](#new-salesforcesandbox), [Remove-SalesforceSandbox](#remove-salesforcesandbox), [Resume-SalesforceSandbox](#resume-salesforcesandbox), [Update-SalesforceSandbox](#update-salesforcesandbox)

**Scratch Orgs**: [Get-SalesforceScratchOrgs](#get-salesforcescratchorgs), [New-SalesforceScratchOrg](#new-salesforcescratchorg), [Remove-SalesforceScratchOrg](#remove-salesforcescratchorg), [Remove-SalesforceScratchOrgs](#remove-salesforcescratchorgs), [Resume-SalesforceScratchOrg](#resume-salesforcescratchorg)

## Sandboxes

### Copy-SalesforceSandbox

#### Synopsis

Creates a sandbox as a copy of another sandbox.

#### Syntax

```powershell
Copy-SalesforceSandbox -SourceSandboxName <String> -CloneSandboxName <String> [-LicenseType <String>] [-Alias <String>] [-WaitMinutes <Int32>] [-NoPrompt] [-Async] [-PollIntervalSeconds <Int32>] [-SetDefault] [-TargetOrg <String>] [<CommonParameters>]
Copy-SalesforceSandbox -SourceId <String> -CloneSandboxName <String> [-LicenseType <String>] [-Alias <String>] [-WaitMinutes <Int32>] [-NoPrompt] [-Async] [-PollIntervalSeconds <Int32>] [-SetDefault] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Runs sf org create sandbox with --source-sandbox-name, which clones an existing sandbox. The CLI waits only when you give -WaitMinutes.

#### Parameters

- `-SourceSandboxName` (String, required): Name of the sandbox org to clone. Passed to sf as --source-sandbox-name. Required unless you give -SourceId.
- `-SourceId` (String, required): ID of the sandbox to clone, instead of its name. Passed to sf as --source-id. Use it instead of -SourceSandboxName.
- `-CloneSandboxName` (String, required): Name of the sandbox org. Passed to sf as --name. Required.
- `-LicenseType` (String): Type of sandbox license. Passed to sf as --license-type.
- `-Alias` (String): Alias for the sandbox org. Passed to sf as --alias.
- `-WaitMinutes` (Int32): Number of minutes to wait for the sandbox org to be ready. Passed to sf as --wait.
- `-NoPrompt` (switch): Don't prompt for confirmation about the sandbox configuration. Adds --no-prompt.
- `-Async` (switch): Request the clone and return at once, without waiting for it to be ready. Finish with Resume-SalesforceSandbox. Adds --async.
- `-PollIntervalSeconds` (Int32): Number of seconds to wait between checks while waiting for the sandbox. Passed to sf as --poll-interval.
- `-SetDefault` (switch): Set the sandbox as your default org once it is ready. Adds --set-default.
- `-TargetOrg` (String): Username or alias of the production org that contains the sandbox license. Passed to sf as --target-org.

#### Salesforce CLI

- `sf org create sandbox`

#### Examples

```powershell
PS> Copy-SalesforceSandbox -SourceSandboxName dev1 -CloneSandboxName dev2 -TargetOrg prod
```

Clone dev1 as dev2.

#### Remarks

- To see the examples, type: "Get-Help Copy-SalesforceSandbox -Examples"
- For more information, type: "Get-Help Copy-SalesforceSandbox -Detailed"
- For technical information, type: "Get-Help Copy-SalesforceSandbox -Full"
- For online help, type: "Get-Help Copy-SalesforceSandbox -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceSandboxes

#### Synopsis

Lists the sandboxes this computer is logged in to.

#### Syntax

```powershell
Get-SalesforceSandboxes [[-Name] <String>] [<CommonParameters>]
```

#### Description

Runs sf org list and returns the connected orgs that are sandboxes. With -Name, only those whose sandbox name, user name or alias equals it. It reads the local list of orgs; there is no -TargetOrg.

#### Parameters

- `-Name` (String): Keep only sandboxes whose sandbox name, user name or alias equals this value. The filter runs in PowerShell.

#### Salesforce CLI

- `sf org list`

#### Examples

```powershell
PS> Get-SalesforceSandboxes
```

Every sandbox this computer knows about.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceSandboxes -Examples"
- For more information, type: "Get-Help Get-SalesforceSandboxes -Detailed"
- For technical information, type: "Get-Help Get-SalesforceSandboxes -Full"
- For online help, type: "Get-Help Get-SalesforceSandboxes -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforceSandboxRefreshStatus

#### Synopsis

Shows when a sandbox was last refreshed and its refresh state.

#### Syntax

```powershell
Get-SalesforceSandboxRefreshStatus [-Name] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf data query on the Tooling API objects SandboxInfo and SandboxProcess (two queries) for the sandbox name, and combines them. The name is escaped as a SOQL literal.

#### Parameters

- `-Name` (String, required): Name of the sandbox. Required.
- `-TargetOrg` (String): 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 data query`

#### Examples

```powershell
PS> Get-SalesforceSandboxRefreshStatus -Name dev1 -TargetOrg prod
```

The refresh status of dev1.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceSandboxRefreshStatus -Examples"
- For more information, type: "Get-Help Get-SalesforceSandboxRefreshStatus -Detailed"
- For technical information, type: "Get-Help Get-SalesforceSandboxRefreshStatus -Full"
- For online help, type: "Get-Help Get-SalesforceSandboxRefreshStatus -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-data>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceSandbox

#### Synopsis

Creates a sandbox from production.

#### Syntax

```powershell
New-SalesforceSandbox [-SandboxName] <String> [[-Alias] <String>] [[-DefinitionFile] <String>] [[-LicenseType] <String>] [[-WaitMinutes] <Int32>] [-NoPrompt] [-NoTrackSource] [-Async] [[-PollIntervalSeconds] <Int32>] [-SetDefault] [[-SourceId] <String>] [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf org create sandbox. A sandbox uses a license of your production org. The CLI waits only when you give -WaitMinutes; otherwise finish with Resume-SalesforceSandbox.

#### Parameters

- `-SandboxName` (String, required): Name of the sandbox org. Passed to sf as --name. Required.
- `-Alias` (String): Alias for the sandbox org. Passed to sf as --alias.
- `-DefinitionFile` (String): Path to a sandbox definition file. Passed to sf as --definition-file.
- `-LicenseType` (String): Type of sandbox license. Passed to sf as --license-type. Default: Developer. Valid values: Developer, Developer_Pro, Partial, Full.
- `-WaitMinutes` (Int32): Number of minutes to wait for the sandbox org to be ready. Passed to sf as --wait.
- `-NoPrompt` (switch): Don't prompt for confirmation about the sandbox configuration. Adds --no-prompt.
- `-NoTrackSource` (switch): Do not use source tracking for this sandbox. Adds --no-track-source.
- `-Async` (switch): Request the sandbox and return at once, without waiting for it to be ready. Finish with Resume-SalesforceSandbox. Adds --async.
- `-PollIntervalSeconds` (Int32): Number of seconds to wait between checks while waiting for the sandbox. Passed to sf as --poll-interval.
- `-SetDefault` (switch): Set the sandbox as your default org once it is ready. Adds --set-default.
- `-SourceId` (String): ID of the sandbox to clone, as an alternative to -SourceSandboxName of Copy-SalesforceSandbox. Passed to sf as --source-id.
- `-TargetOrg` (String): Username or alias of the production org that contains the sandbox license. Passed to sf as --target-org.

#### Salesforce CLI

- `sf org create sandbox`

#### Examples

```powershell
PS> New-SalesforceSandbox -SandboxName dev2 -LicenseType Developer -TargetOrg prod
```

Create a developer sandbox.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceSandbox -Examples"
- For more information, type: "Get-Help New-SalesforceSandbox -Detailed"
- For technical information, type: "Get-Help New-SalesforceSandbox -Full"
- For online help, type: "Get-Help New-SalesforceSandbox -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceSandbox

#### Synopsis

Deletes a sandbox.

#### Syntax

```powershell
Remove-SalesforceSandbox [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org delete sandbox. This cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt also turns off the CLI's own question.

#### Parameters

- `-NoPrompt` (switch): Don't prompt the user to confirm the deletion. Adds --no-prompt.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org delete sandbox`

#### Examples

```powershell
PS> Remove-SalesforceSandbox -TargetOrg dev2 -WhatIf
```

Preview the delete.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceSandbox -Examples"
- For more information, type: "Get-Help Remove-SalesforceSandbox -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceSandbox -Full"
- For online help, type: "Get-Help Remove-SalesforceSandbox -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforceSandbox

#### Synopsis

Checks a sandbox creation and logs in to it when it is ready.

#### Syntax

```powershell
Resume-SalesforceSandbox -SandboxName <String> [-WaitMinutes <Int32>] [-TargetOrg <String>] [<CommonParameters>]
Resume-SalesforceSandbox -JobId <String> [-WaitMinutes <Int32>] [-TargetOrg <String>] [<CommonParameters>]
Resume-SalesforceSandbox -UseMostRecent [-WaitMinutes <Int32>] [-TargetOrg <String>] [<CommonParameters>]
```

#### Description

Runs sf org resume sandbox. Use it after New-SalesforceSandbox, Copy-SalesforceSandbox or Update-SalesforceSandbox returned without waiting. Say which sandbox with -SandboxName, with the -JobId of the sandbox process, or with -UseMostRecent for the latest one.

#### Parameters

- `-SandboxName` (String, required): Name of the sandbox org. Passed to sf as --name. Required unless you give -JobId or -UseMostRecent.
- `-JobId` (String, required): ID of the sandbox creation or refresh process (the SandboxProcess ID, starting 0GR). Passed to sf as --job-id. Use it instead of -SandboxName.
- `-UseMostRecent` (switch, required): Resume the most recent sandbox creation or refresh. Adds --use-most-recent. Use it instead of -SandboxName.
- `-WaitMinutes` (Int32): Number of minutes to wait for the sandbox org to be ready. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the production org that contains the sandbox license. Passed to sf as --target-org.

#### Salesforce CLI

- `sf org resume sandbox`

#### Examples

```powershell
PS> Resume-SalesforceSandbox -SandboxName dev2 -WaitMinutes 30 -TargetOrg prod
```

Wait up to 30 minutes.

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforceSandbox -Examples"
- For more information, type: "Get-Help Resume-SalesforceSandbox -Detailed"
- For technical information, type: "Get-Help Resume-SalesforceSandbox -Full"
- For online help, type: "Get-Help Resume-SalesforceSandbox -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforceSandbox

#### Synopsis

Refreshes a sandbox from production or from another sandbox.

#### Syntax

```powershell
Update-SalesforceSandbox [[-SandboxName] <String>] [[-DefinitionFile] <String>] [[-SourceSandboxName] <String>] [[-SourceId] <String>] [-NoAutoActivate] [-Async] [[-WaitMinutes] <Int32>] [[-PollIntervalSeconds] <Int32>] [-NoPrompt] [[-TargetOrg] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org refresh sandbox. A refresh replaces the sandbox's data and metadata with a fresh copy, so everything in it that is not in the source is lost. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. psfdx confirms first, so it always passes --no-prompt and the CLI does not ask a second time. The CLI waits only when you give -WaitMinutes; otherwise finish with Resume-SalesforceSandbox. Give the sandbox with -SandboxName, or put its name in a -DefinitionFile.

#### Parameters

- `-SandboxName` (String): Name of the sandbox to refresh. Passed to sf as --name.
- `-DefinitionFile` (String): Path to a sandbox definition file that holds the refresh settings, such as the license type. Passed to sf as --definition-file.
- `-SourceSandboxName` (String): Name of the sandbox to refresh from, instead of production. Passed to sf as --source-sandbox-name.
- `-SourceId` (String): ID of the sandbox to refresh from, instead of its name. Passed to sf as --source-id.
- `-NoAutoActivate` (switch): Do not activate the sandbox when the refresh finishes; you activate it yourself later. Adds --no-auto-activate.
- `-Async` (switch): Start the refresh and return at once, without waiting for it to finish. Finish with Resume-SalesforceSandbox. Adds --async.
- `-WaitMinutes` (Int32): Number of minutes to wait for the refresh to finish. Passed to sf as --wait.
- `-PollIntervalSeconds` (Int32): Number of seconds to wait between checks while waiting for the refresh. Passed to sf as --poll-interval.
- `-NoPrompt` (switch): Don't ask for confirmation. Skips the PowerShell confirmation; psfdx always passes --no-prompt to the CLI after it has confirmed.
- `-TargetOrg` (String): Username or alias of the production org that owns the sandbox. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org refresh sandbox`

#### Examples

```powershell
PS> Update-SalesforceSandbox -SandboxName dev1 -TargetOrg prod -WhatIf
```

Preview the refresh without starting it.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforceSandbox -Examples"
- For more information, type: "Get-Help Update-SalesforceSandbox -Detailed"
- For technical information, type: "Get-Help Update-SalesforceSandbox -Full"
- For online help, type: "Get-Help Update-SalesforceSandbox -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

## Scratch Orgs

### Get-SalesforceScratchOrgs

#### Synopsis

Lists the scratch orgs this computer knows about.

#### Syntax

```powershell
Get-SalesforceScratchOrgs [-SkipConnectionStatus] [-Last] [<CommonParameters>]
```

#### Description

Runs sf org list --all and returns the scratch orgs. Every object has orgId, instanceUrl, username, connectedStatus, isDevHub, lastUsed and alias, plus any of these the CLI reports: expirationDate, isExpired, createdDate, createdBy, devHubUsername, devHubId, edition, status, orgName, namespace, signupUsername, aliases, instanceApiVersion, isDefaultUsername and similar non-secret details. Only these named properties are copied, so the access token in the CLI result is never returned. A CLI failure throws instead of returning nothing. With -Last only the most recently used one is returned.

#### Parameters

- `-SkipConnectionStatus` (switch): Skip retrieving the connection status of non-scratch orgs. Adds --skip-connection-status.
- `-Last` (switch): Return only the scratch org with the latest lastUsed date. The sorting happens in PowerShell.

#### Salesforce CLI

- `sf org list`

#### Examples

```powershell
PS> Get-SalesforceScratchOrgs | Where-Object connectedStatus -eq 'Connected'
```

Scratch orgs that are reachable.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforceScratchOrgs -Examples"
- For more information, type: "Get-Help Get-SalesforceScratchOrgs -Detailed"
- For technical information, type: "Get-Help Get-SalesforceScratchOrgs -Full"
- For online help, type: "Get-Help Get-SalesforceScratchOrgs -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### New-SalesforceScratchOrg

#### Synopsis

Creates a scratch org.

#### Syntax

```powershell
New-SalesforceScratchOrg [[-TargetDevHub] <String>] [-SetDefault] [[-DurationDays] <Int32>] [[-DefinitionFile] <String>] [[-WaitMinutes] <Int32>] [-Async] [[-Edition] <String>] [[-Snapshot] <String>] [[-AdminEmail] <String>] [[-Description] <String>] [[-Name] <String>] [[-Release] <String>] [[-SourceOrgId] <String>] [[-AdminUsername] <String>] [[-Alias] <String>] [[-OAuthClientId] <String>] [-NoAncestors] [-NoNamespace] [-NoTrackSource] [<CommonParameters>]
```

#### Description

Runs sf org create scratch from a scratch org definition file. Use -Async to return before the org is ready, then finish with Resume-SalesforceScratchOrg. Scratch orgs use your Dev Hub's allocation and expire after the duration.

#### Parameters

- `-TargetDevHub` (String): Username or alias of the Dev Hub org. Passed to sf as --target-dev-hub.
- `-SetDefault` (switch): Set the scratch org as your default org. Adds --set-default.
- `-DurationDays` (Int32): Number of days before the org expires. Passed to sf as --duration-days.
- `-DefinitionFile` (String): Path to a scratch org definition file. Passed to sf as --definition-file. Default: config/project-scratch-def.json.
- `-WaitMinutes` (Int32): Number of minutes to wait for the scratch org to be ready. Passed to sf as --wait.
- `-Async` (switch): Request the org, but don't wait for it to complete. Adds --async.
- `-Edition` (String): Salesforce edition of the scratch org. Overrides the value of the "edition" option in the definition file, if set. Passed to sf as --edition. Valid values: developer, enterprise, group, professional, partner-developer, partner-enterprise, partner-group, partner-professional.
- `-Snapshot` (String): Name of the snapshot to use when creating this scratch org. Overrides the value of the "snapshot" option in the defintion file, if set. Passed to sf as --snapshot.
- `-AdminEmail` (String): Email address that will be applied to the org's admin user. Overrides the value of the "adminEmail" option in the definition file, if set. Passed to sf as --admin-email.
- `-Description` (String): Description of the scratch org in the Dev Hub. Overrides the value of the "description" option in the definition file, if set. Passed to sf as --description.
- `-Name` (String): Name of the org, such as "Acme Company". Overrides the value of the "orgName" option in the definition file, if set. Passed to sf as --name.
- `-Release` (String): Release of the scratch org as compared to the Dev Hub release. Passed to sf as --release. Valid values: preview, previous.
- `-SourceOrgId` (String): 15-character ID of the org shape that the new scratch org is based on. Overrides the value of the "sourceOrg" option in the definition file, if set. Passed to sf as --source-org.
- `-AdminUsername` (String): Username of the scratch org admin user. Overrides the value of the "username" option in the definition file, if set. Passed to sf as --username.
- `-Alias` (String): Alias for the scratch org. Passed to sf as --alias.
- `-OAuthClientId` (String): OAuth client ID (also called consumer key) of your connected app, used to log in to the new scratch org. Passed to sf as --client-id.
- `-NoAncestors` (switch): Don't include second-generation managed package (2GP) ancestors in the scratch org. Adds --no-ancestors.
- `-NoNamespace` (switch): Create the scratch org without the namespace of the Dev Hub or the project, even if the project has one. Adds --no-namespace.
- `-NoTrackSource` (switch): Create the scratch org without source tracking. Scratch orgs have source tracking on by default. Adds --no-track-source.

#### Salesforce CLI

- `sf org create scratch`

#### Examples

```powershell
PS> New-SalesforceScratchOrg -DefinitionFile config/project-scratch-def.json -Name ci-1 -DurationDays 3 -SetDefault
```

Create a three-day scratch org and make it the default.

#### Remarks

- To see the examples, type: "Get-Help New-SalesforceScratchOrg -Examples"
- For more information, type: "Get-Help New-SalesforceScratchOrg -Detailed"
- For technical information, type: "Get-Help New-SalesforceScratchOrg -Full"
- For online help, type: "Get-Help New-SalesforceScratchOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceScratchOrg

#### Synopsis

Deletes a scratch org.

#### Syntax

```powershell
Remove-SalesforceScratchOrg [-TargetOrg] <String> [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf org delete scratch. This cannot be undone. Asks for confirmation and supports -WhatIf; -NoPrompt also turns off the CLI's own question.

#### Parameters

- `-TargetOrg` (String, required): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org. Required.
- `-NoPrompt` (switch): Don't prompt the user to confirm the deletion. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf org delete scratch`

#### Examples

```powershell
PS> Remove-SalesforceScratchOrg -TargetOrg ci-1 -WhatIf
```

Show which org would be deleted.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceScratchOrg -Examples"
- For more information, type: "Get-Help Remove-SalesforceScratchOrg -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceScratchOrg -Full"
- For online help, type: "Get-Help Remove-SalesforceScratchOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforceScratchOrgs

#### Synopsis

Deletes every scratch org this computer knows about.

#### Syntax

```powershell
Remove-SalesforceScratchOrgs [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Lists scratch orgs with Get-SalesforceScratchOrgs and deletes each one with Remove-SalesforceScratchOrg -NoPrompt. One confirmation names all of them. This cannot be undone. Supports -WhatIf.

#### Parameters

- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Remove-SalesforceScratchOrgs -WhatIf
```

List the orgs that would be deleted.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforceScratchOrgs -Examples"
- For more information, type: "Get-Help Remove-SalesforceScratchOrgs -Detailed"
- For technical information, type: "Get-Help Remove-SalesforceScratchOrgs -Full"
- For online help, type: "Get-Help Remove-SalesforceScratchOrgs -Online"

#### Related Links

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Resume-SalesforceScratchOrg

#### Synopsis

Resumes a scratch org creation that was started with New-SalesforceScratchOrg -Async or that timed out (sf org resume scratch).

#### Syntax

```powershell
Resume-SalesforceScratchOrg [[-JobId] <String>] [-UseMostRecent] [[-WaitMinutes] <Int32>] [<CommonParameters>]
```

#### Description

Select the creation by -JobId (the scratch org info ID, starting 2SR, reported when the creation was started) or by -UseMostRecent. The CLI keeps a local record of the job, so there is no -TargetOrg; resume from the machine that started it. Returns the CLI result (org ID, username, instance URL) with Completed: true once the org is ready. A creation that is still running when -WaitMinutes ends (the CLI's StillInProgressError) returns Completed: false with Status InProgress, so a script can poll; a failed creation throws the CLI message. Permission sets are assigned afterwards with Grant-SalesforcePermissionSet (psfdx), which asks for confirmation.

#### Parameters

- `-JobId` (String): Job ID of the incomplete scratch org create that you want to resume. Passed to sf as --job-id.
- `-UseMostRecent` (switch): Resume the creation the CLI started most recently. Passed as --use-most-recent. Use instead of -JobId.
- `-WaitMinutes` (Int32): Number of minutes to wait for the scratch org to be ready. Passed to sf as --wait. Range: 1 to 1440.

#### Salesforce CLI

- `sf org resume scratch`

#### Examples

```powershell
PS> New-SalesforceScratchOrg -Async -Name ci-1 | Out-Null
PS> Resume-SalesforceScratchOrg -UseMostRecent -WaitMinutes 10
PS> Grant-SalesforcePermissionSet -Name MyPermSet -TargetOrg ci-1
```

#### Remarks

- To see the examples, type: "Get-Help Resume-SalesforceScratchOrg -Examples"
- For more information, type: "Get-Help Resume-SalesforceScratchOrg -Detailed"
- For technical information, type: "Get-Help Resume-SalesforceScratchOrg -Full"
- For online help, type: "Get-Help Resume-SalesforceScratchOrg -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-org>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

---

# psfdx-packages command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-packages/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

30 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

**First-generation packages**: [Convert-SalesforcePackage](#convert-salesforcepackage), [Get-SalesforceFirstGenPackageVersion](#get-salesforcefirstgenpackageversion), [Get-SalesforceFirstGenPackageVersionCreateStatus](#get-salesforcefirstgenpackageversioncreatestatus), [Get-SalesforceFirstGenPackageVersions](#get-salesforcefirstgenpackageversions), [New-SalesforceFirstGenPackageVersion](#new-salesforcefirstgenpackageversion)

**Package management**: [Get-SalesforcePackage](#get-salesforcepackage), [Get-SalesforcePackages](#get-salesforcepackages), [New-SalesforcePackage](#new-salesforcepackage), [Remove-SalesforcePackage](#remove-salesforcepackage), [Update-SalesforcePackage](#update-salesforcepackage)

**Installation and removal from orgs**: [Get-SalesforcePackageInstallStatus](#get-salesforcepackageinstallstatus), [Get-SalesforcePackagesInstalled](#get-salesforcepackagesinstalled), [Get-SalesforcePackageUninstallStatus](#get-salesforcepackageuninstallstatus), [Install-SalesforcePackageVersion](#install-salesforcepackageversion), [Uninstall-SalesforcePackage](#uninstall-salesforcepackage)

**Package versions**: [Get-SalesforcePackageVersion](#get-salesforcepackageversion), [Get-SalesforcePackageVersionAncestry](#get-salesforcepackageversionancestry), [Get-SalesforcePackageVersionCreateRequests](#get-salesforcepackageversioncreaterequests), [Get-SalesforcePackageVersionCreateStatus](#get-salesforcepackageversioncreatestatus), [Get-SalesforcePackageVersionDependencies](#get-salesforcepackageversiondependencies), [Get-SalesforcePackageVersions](#get-salesforcepackageversions), [New-SalesforcePackageVersion](#new-salesforcepackageversion), [Promote-SalesforcePackageVersion](#promote-salesforcepackageversion), [Remove-SalesforcePackageVersion](#remove-salesforcepackageversion), [Retrieve-SalesforcePackageVersion](#retrieve-salesforcepackageversion), [Update-SalesforcePackageVersion](#update-salesforcepackageversion)

**Push upgrades**: [Get-SalesforcePushUpgrade](#get-salesforcepushupgrade), [Get-SalesforcePushUpgrades](#get-salesforcepushupgrades), [New-SalesforcePushUpgrade](#new-salesforcepushupgrade), [Stop-SalesforcePushUpgrade](#stop-salesforcepushupgrade)

## First-generation packages

### Convert-SalesforcePackage

#### Synopsis

Converts a first-generation managed package into a second-generation managed package.

#### Syntax

```powershell
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

- `-Package` (String, required): ID of the first-generation managed package to convert (starts with 033). Passed to sf as --package. Required.
- `-DefinitionFile` (String): Path to a scratch org definition file used to validate the converted package version. The file must exist. Passed to sf as --definition-file.
- `-InstallationKey` (String): 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.
- `-InstallationKeyBypass` (switch): Do not protect the converted package version with an installation key. Adds --installation-key-bypass.
- `-CodeCoverage` (switch): Calculate and store the code coverage of the converted package version. Adds --code-coverage.
- `-PatchVersion` (String): Patch version number to give the converted package version. Passed to sf as --patch-version.
- `-SeedMetadata` (String): 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.
- `-ExtendedDetails` (switch): Show extended details of the conversion. Adds --verbose.
- `-WaitMinutes` (Int32): Number of minutes to wait for the conversion to finish. Passed to sf as --wait.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package convert`

#### Examples

```powershell
PS> Convert-SalesforcePackage -Package 033xx0000000001AAA -InstallationKeyBypass -WaitMinutes 30 -TargetDevHub devhub
```

Convert 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

```powershell
Get-SalesforceFirstGenPackageVersion [-PackageVersionId] <String> [[-TargetOrg] <String>] [<CommonParameters>]
```

#### Description

Runs sf package1 version display. It only reads.

#### Parameters

- `-PackageVersionId` (String, required): ID of the package version (starts with 04t). Passed to sf as --package-version-id. Required.
- `-TargetOrg` (String): 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

```powershell
PS> Get-SalesforceFirstGenPackageVersion -PackageVersionId 04txx0000000001AAA -TargetOrg packaging
```

The 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

```powershell
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

- `-RequestId` (String, required): ID of the upload request. Passed to sf as --request-id. Required.
- `-TargetOrg` (String): 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

```powershell
PS> Get-SalesforceFirstGenPackageVersionCreateStatus -RequestId 0HD000000000001 -TargetOrg packaging
```

The 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

```powershell
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

- `-PackageId` (String): ID of the first-generation package (starts with 033). By default all packages of the org. Passed to sf as --package-id.
- `-TargetOrg` (String): 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

```powershell
PS> Get-SalesforceFirstGenPackageVersions -TargetOrg packaging | Format-Table
```

Every 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

```powershell
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

- `-PackageId` (String, required): ID of the first-generation package (starts with 033). Passed to sf as --package-id. Required.
- `-Name` (String, required): Name of the package version. Passed to sf as --name. Required.
- `-Description` (String): Description of the package version. Passed to sf as --description.
- `-Version` (String): Version number of the package version, for example 1.2. Passed to sf as --version.
- `-InstallationKey` (String): Installation key that subscribers give when they install the version. Passed to sf as --installation-key.
- `-ManagedReleased` (switch): Upload the version as managed-released, which cannot be deleted or changed. Without it the version is a beta. Adds --managed-released.
- `-PostInstallUrl` (String): URL of the post-install instructions. Passed to sf as --post-install-url.
- `-ReleaseNotesUrl` (String): URL of the release notes. Passed to sf as --release-notes-url.
- `-WaitMinutes` (Int32): Number of minutes to wait for the upload to finish. Passed to sf as --wait.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package1 version create`

#### Examples

```powershell
PS> New-SalesforceFirstGenPackageVersion -PackageId 033xx0000000001AAA -Name 'Spring release' -Version 2.1 -WaitMinutes 20 -TargetOrg packaging
```

Upload 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

```powershell
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

- `-Name` (String, required): Exact name of the package. Required.
- `-TargetDevHub` (String): 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.
- `-ExtendedPackageDetails` (switch): Include extended package details. Passed to Get-SalesforcePackages, which passes it to sf as --verbose.

#### Salesforce CLI

No direct Salesforce CLI command.

#### Examples

```powershell
PS> Get-SalesforcePackage -Name MyPackage -TargetDevHub devhub
```

The 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

- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforcePackages

#### Synopsis

Lists the packages in a Dev Hub.

#### Syntax

```powershell
Get-SalesforcePackages [[-TargetDevHub] <String>] [-ExtendedPackageDetails] [<CommonParameters>]
```

#### Description

Runs sf package list and returns one object per package.

#### Parameters

- `-TargetDevHub` (String): 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.
- `-ExtendedPackageDetails` (switch): Display extended package detail. Adds --verbose.

#### Salesforce CLI

- `sf package list`

#### Examples

```powershell
PS> Get-SalesforcePackages -TargetDevHub devhub
```

Every 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

```powershell
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

- `-Name` (String, required): Name of the package to create. Passed to sf as --name. Required.
- `-PackageType` (String): Type of package. Passed to sf as --package-type. Default: "Unlocked". Valid values: Managed, Unlocked.
- `-IsOrgDependent` (switch): Depends on unpackaged metadata in the installation org; applies to unlocked packages only. Adds --org-dependent.
- `-Path` (String): Path to directory that contains the contents of the package. Passed to sf as --path. Default: "force-app/main/default".
- `-Description` (String): Description of the package. Passed to sf as --description.
- `-ErrorNotificationUsername` (String): Active Dev Hub user designated to receive email notifications for package errors. Passed to sf as --error-notification-username.
- `-NoNamespace` (switch): Create the package with no namespace; available only for unlocked packages. Adds --no-namespace.
- `-TargetDevHub` (String): 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

```powershell
PS> New-SalesforcePackage -Name MyPackage -PackageType Unlocked -Path force-app -TargetDevHub devhub
```

An 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

```powershell
Remove-SalesforcePackage [-Name] <String> [[-TargetDevHub] <String>] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf package delete. Asks for confirmation and supports -WhatIf.

#### Parameters

- `-Name` (String, required): ID (starts with 0Ho) or alias of the package to delete. Passed to sf as --package. Required.
- `-TargetDevHub` (String): 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.
- `-NoPrompt` (switch): Don't prompt before deleting the package. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package delete`

#### Examples

```powershell
PS> Remove-SalesforcePackage -Name MyPackage -TargetDevHub devhub -WhatIf
```

Preview 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

```powershell
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

- `-Package` (String, required): ID (starts with 0Ho) or alias of the package to update. Passed to sf as --package. Required.
- `-Name` (String): New name of the package. Passed to sf as --name.
- `-Description` (String): New description of the package. Passed to sf as --description.
- `-ErrorNotificationUsername` (String): 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.
- `-EnableAppAnalytics` (switch): Turn on AppExchange App Analytics for the managed package. Adds --enable-app-analytics.
- `-RecommendedVersionId` (String): ID of the package version to recommend to subscribers, starting with 04t. Passed to sf as --recommended-version-id.
- `-SkipAncestorCheck` (switch): Do not check that the recommended version has the right ancestor. Adds --skip-ancestor-check.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package update`

#### Examples

```powershell
PS> Update-SalesforcePackage -Package MyPkg -Description 'Core features' -TargetDevHub devhub -WhatIf
```

Preview 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

```powershell
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

- `-RequestId` (String, required): ID of the package install request you want to check; starts with 0Hf. Passed to sf as --request-id. Required.
- `-ThrowOnFailure` (switch): Throw an error (id PsfdxPackageJobFailed) when the installation failed, instead of returning it with Status ERROR. Meant for CI.
- `-TargetOrg` (String): 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

```powershell
PS> $install = Install-SalesforcePackageVersion -PackageVersionId 04t000000000001 -WaitMinutes 0 -NoPrompt -AsObject -TargetOrg myorg; Get-SalesforcePackageInstallStatus -RequestId $install.Id -TargetOrg myorg
```

#### Remarks

- 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

```powershell
Get-SalesforcePackagesInstalled [[-TargetOrg] <String>] [[-ApiVersion] <String>] [<CommonParameters>]
```

#### Description

Runs sf package installed list and returns one object per installed package version.

#### Parameters

- `-TargetOrg` (String): Username or alias of the org. If omitted, the Salesforce CLI uses the default target org. Passed to sf as --target-org.
- `-ApiVersion` (String): 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

```powershell
PS> Get-SalesforcePackagesInstalled -TargetOrg dev1
```

What 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

```powershell
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

- `-RequestId` (String, required): ID of the uninstall request, from Uninstall-SalesforcePackage. Passed to sf as --request-id. Required.
- `-TargetOrg` (String): 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

```powershell
PS> Get-SalesforcePackageUninstallStatus -RequestId 06yxx0000000001AAA -TargetOrg dev1
```

The 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

```powershell
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

- `-PackageVersionId` (String, required): ID (starts with 04t) or alias of the package version to install. Passed to sf as --package. Required.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-NoPrompt` (switch): Don't prompt for confirmation. Adds --no-prompt.
- `-WaitMinutes` (Int32): 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.
- `-SecurityType` (String): 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.
- `-AsObject` (switch): 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.
- `-ApexCompile` (String): 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.
- `-InstallationKey` (String): Installation key of the package version, for a version that is protected by one. Passed to sf as --installation-key.
- `-UpgradeType` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package install`

#### Examples

```powershell
PS> Install-SalesforcePackageVersion -PackageVersionId 04t000000000001AAA -TargetOrg dev1 -WhatIf
```

Preview 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

```powershell
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

- `-Package` (String, required): ID (starts with 04t) or alias of the package version to uninstall. Passed to sf as --package. Required.
- `-WaitMinutes` (Int32): Number of minutes to wait for the uninstall to finish. Passed to sf as --wait.
- `-NoPrompt` (switch): 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.
- `-TargetOrg` (String): Username or alias of the target org. Not required if the `target-org` configuration variable is already set. Passed to sf as --target-org.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package uninstall`

#### Examples

```powershell
PS> Uninstall-SalesforcePackage -Package 04txx0000000001AAA -WaitMinutes 10 -TargetOrg dev1 -WhatIf
```

Preview 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

```powershell
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

- `-PackageVersionId` (String, required): ID (starts with 04t) or alias of the package version. Passed to sf as --package. Required.
- `-ExtendedDetails` (switch): Show extended details, such as the package version's ancestry. Adds --verbose.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -TargetDevHub devhub
```

The 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

```powershell
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

- `-Package` (String, 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.
- `-DotCode` (switch): Return the ancestry as DOT code for Graphviz. Adds --dot-code.
- `-ExtendedDetails` (switch): Show extended details of each version, such as its ID. Adds --verbose.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePackageVersionAncestry -Package MyManagedPkg -TargetDevHub devhub
```

The 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

```powershell
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

- `-CreatedLastDays` (Int32): Only requests created in the last this many days. 0 means today. Passed to sf as --created-last-days.
- `-ConversionsOnly` (switch): Only requests that convert a first-generation package. Adds --show-conversions-only.
- `-Status` (String): Only requests with this status. Valid values: Queued, InProgress, Success, Error. Passed to sf as --status.
- `-ExtendedDetails` (switch): Show extended details of each request. Adds --verbose.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePackageVersionCreateRequests -Status Error -CreatedLastDays 7 -TargetDevHub devhub
```

Version 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

```powershell
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

- `-RequestId` (String, required): ID (starts with 08c) of the package version creation request you want to display. Passed to sf as --package-create-request-id. Required.
- `-ThrowOnFailure` (switch): Throw an error (id PsfdxPackageJobFailed) when the version creation failed, instead of returning it with its status. Meant for CI.
- `-TargetDevHub` (String): 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

```powershell
PS> $create = New-SalesforcePackageVersion -PackageName MyPkg -TargetDevHub devhub; Get-SalesforcePackageVersionCreateStatus -RequestId $create.Id -TargetDevHub devhub
```

#### Remarks

- 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

```powershell
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

- `-PackageVersionId` (String, required): ID (starts with 04t) or alias of the package version. Passed to sf as --package. Required.
- `-EdgeDirection` (String): Direction of the graph edges. Valid values: root-first, root-last. The CLI default is root-first. Passed to sf as --edge-direction.
- `-InstallationKey` (String): Installation key of the package version, if it has one. Passed to sf as --installation-key.
- `-ExtendedDetails` (switch): Show extended details of each dependency. Adds --verbose.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePackageVersionDependencies -PackageVersionId 04txx0000000001AAA -TargetDevHub devhub
```

What 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

```powershell
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

- `-PackageId` (String): Comma-delimited list of packages (aliases or 0Ho IDs) to list. Passed to sf as --packages.
- `-PackageName` (String): Name of the package. psfdx finds its ID with Get-SalesforcePackage and passes it as --packages. Use instead of -PackageId.
- `-Released` (switch): Display released versions only (IsReleased=true). Adds --released.
- `-Concise` (switch): Display limited package version details. Adds --concise.
- `-ExtendedDetails` (switch): Display extended package version details. Adds --verbose.
- `-ConversionsOnly` (switch): Filter the list output to display only converted package version. Adds --show-conversions-only.
- `-Branch` (String): 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.
- `-CreatedLastDays` (Int32): Only versions created in the last this many days. 0 means today. Passed to sf as --created-last-days.
- `-ModifiedLastDays` (Int32): Only versions modified in the last this many days. 0 means today. Passed to sf as --modified-last-days.
- `-OrderBy` (String): Package version fields to order the list by, separated by commas, for example PatchVersion,MajorVersion. Passed to sf as --order-by.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePackageVersions -PackageName MyPackage -Released -TargetDevHub devhub
```

Released 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

```powershell
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

- `-PackageId` (String): ID (starts with 0Ho) or alias of the package to create a version of. Passed to sf as --package.
- `-PackageName` (String): Name of the package. psfdx finds its ID with Get-SalesforcePackage and passes it as --package. Use instead of -PackageId.
- `-Name` (String): Name of the package version to be created; overrides the sfdx-project.json value. Passed to sf as --version-name.
- `-Description` (String): Description of the package version to be created; overrides the sfdx-project.json value. Passed to sf as --version-description.
- `-Tag` (String): Package version's tag. Passed to sf as --tag.
- `-InstallationKey` (String): Installation key for key-protected package. (either --installation-key or --installation-key-bypass is required).
- `-InstallationKeyBypass` (switch): Bypass the installation key requirement. (either --installation-key or --installation-key-bypass is required).
- `-CodeCoverage` (switch): Calculate and store the code coverage percentage by running the packaged Apex tests included in this package version. Adds --code-coverage.
- `-SkipValidation` (switch): Skip validation during package version creation; you can't promote unvalidated package versions. Adds --skip-validation.
- `-WaitMinutes` (Int32): Number of minutes to wait for the package version to be created. Passed to sf as --wait.
- `-ScratchOrgDefinitionFile` (String): 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".
- `-Path` (String): 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.
- `-Branch` (String): Name of the branch in your source control system that the package version is created from. Passed to sf as --branch.
- `-VersionNumber` (String): Version number of the package version, for example 1.2.0.NEXT. Overrides the sfdx-project.json value. Passed to sf as --version-number.
- `-Language` (String): Language of the package version's metadata, as a language code such as en_US. Passed to sf as --language.
- `-PostInstallScript` (String): Name of the Apex class that runs after the package is installed (managed packages only). Passed to sf as --post-install-script.
- `-UninstallScript` (String): Name of the Apex class that runs when the package is uninstalled (managed packages only). Passed to sf as --uninstall-script.
- `-PostInstallUrl` (String): URL of the post-install instructions. Passed to sf as --post-install-url.
- `-ReleaseNotesUrl` (String): URL of the release notes. Passed to sf as --releasenotes-url.
- `-SkipAncestorCheck` (switch): Do not check that the new version has the right ancestor. Adds --skip-ancestor-check.
- `-AsyncValidation` (switch): Return the version as soon as it is created and run the validation, including the Apex tests, in the background. Adds --async-validation.
- `-GeneratePackageZip` (switch): Also create a zip file of the package contents and keep it, for managed package versions. Adds --generate-pkg-zip.
- `-ExtendedDetails` (switch): Show extended details of the version creation. Adds --verbose.
- `-TargetDevHub` (String): 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

```powershell
PS> New-SalesforcePackageVersion -PackageName MyPackage -InstallationKeyBypass -WaitMinutes 30 -TargetDevHub devhub
```

Create 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

```powershell
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

- `-PackageVersionId` (String, 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.
- `-TargetDevHub` (String): 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.
- `-NoPrompt` (switch): Don't prompt to confirm setting the package version as released. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package version promote`

#### Examples

```powershell
PS> Get-SalesforcePackageVersions -PackageName MyPkg | Select-Object -First 1 | Promote-SalesforcePackageVersion -WhatIf
```

#### Remarks

- 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

```powershell
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

- `-PackageVersionId` (String, 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.
- `-TargetDevHub` (String): 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.
- `-NoPrompt` (switch): Don't prompt before deleting the package version. Adds --no-prompt.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package version delete`

#### Examples

```powershell
PS> Get-SalesforcePackageVersions -PackageName MyPkg | Where-Object { -not $_.IsReleased } | Remove-SalesforcePackageVersion -WhatIf
```

#### Remarks

- 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

```powershell
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

- `-PackageVersionId` (String, required): ID (starts with 04t) or alias of the package version to retrieve. Passed to sf as --package. Required.
- `-OutputDirectory` (String): Folder to write the metadata to. By default the CLI uses a temporary folder and reports it. Passed to sf as --output-dir.
- `-TargetDevHub` (String): 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

```powershell
PS> Retrieve-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -OutputDirectory .\pkg-source -TargetDevHub devhub
```

Download 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

```powershell
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

- `-PackageVersionId` (String, required): ID (starts with 04t) or alias of the package version to update. Passed to sf as --package. Required.
- `-Branch` (String): New branch of the package version. Passed to sf as --branch.
- `-InstallationKey` (String): New installation key, a password that subscribers give when they install the version. Passed to sf as --installation-key.
- `-Tag` (String): New tag of the package version. Passed to sf as --tag.
- `-Description` (String): New description of the package version. Passed to sf as --version-description.
- `-Name` (String): New name of the package version. Passed to sf as --version-name.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package version update`

#### Examples

```powershell
PS> Update-SalesforcePackageVersion -PackageVersionId 04txx0000000001AAA -Tag release-1 -TargetDevHub devhub
```

Tag 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

```powershell
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

- `-PushRequestId` (String, required): ID of the push upgrade request (starts with 0DV). Passed to sf as --push-request-id. Required.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePushUpgrade -PushRequestId 0DVxx0000000001AAA -TargetDevHub devhub
```

The 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

```powershell
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

- `-Package` (String, required): ID (starts with 0Ho) or alias of the package. Passed to sf as --package. Required.
- `-ScheduledLastDays` (Int32): Only requests scheduled in the last this many days. Passed to sf as --scheduled-last-days.
- `-ShowMigrationsOnly` (switch): Only requests that migrate subscribers to a second-generation package. Adds --show-push-migrations-only.
- `-Status` (String): Only requests with this status. Valid values: Created, Cancelled, Pending, In Progress, Failed, Succeeded. Passed to sf as --status.
- `-TargetDevHub` (String): 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

```powershell
PS> Get-SalesforcePushUpgrades -Package MyManagedPkg -Status Pending -TargetDevHub devhub
```

Push 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

```powershell
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

- `-Package` (String, required): ID (starts with 04t) or alias of the package version to push. Passed to sf as --package. Required.
- `-OrgList` (String[]): IDs of the subscriber orgs to upgrade (start with 00D). Joined with commas. Passed to sf as --org-list.
- `-OrgFile` (String): Path of a CSV file that lists the subscriber org IDs, one per line. The file must exist. Passed to sf as --org-file.
- `-StartTime` (DateTime): 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.
- `-MigrateTo2gp` (switch): Migrate the subscriber orgs from a first-generation to a second-generation package. Adds --migrate-to-2gp.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package push-upgrade schedule`

#### Examples

```powershell
PS> New-SalesforcePushUpgrade -Package 04txx0000000001AAA -OrgList 00Dxx0000000001, 00Dxx0000000002 -StartTime '2026-12-01 02:00' -TargetDevHub devhub -WhatIf
```

Preview 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

```powershell
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

- `-PushRequestId` (String, required): ID of the push upgrade request to abort (starts with 0DV). Passed to sf as --push-request-id. Required.
- `-NoPrompt` (switch): 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.
- `-TargetDevHub` (String): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf package push-upgrade abort`

#### Examples

```powershell
PS> Stop-SalesforcePushUpgrade -PushRequestId 0DVxx0000000001AAA -TargetDevHub devhub -WhatIf
```

Preview 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>

---

# psfdx-plugins command reference

Generated from the commands' own help by `site/Update-ModuleReference.ps1`: do not edit it by hand. The same reference is on the website: <https://psfdx.com/modules/psfdx-plugins/>. It is part of the `psfdx` package; see the [installation guide](https://github.com/tonygward/psfdx/blob/main/docs/install.md).

11 commands. Every command also takes the common parameters, such as `-Verbose`.

## Commands

[Add-SalesforcePluginAllowlist](#add-salesforcepluginallowlist), [Find-SalesforcePlugins](#find-salesforceplugins), [Get-SalesforcePluginAllowlist](#get-salesforcepluginallowlist), [Get-SalesforcePluginDetails](#get-salesforceplugindetails), [Get-SalesforcePlugins](#get-salesforceplugins), [Install-SalesforcePlugin](#install-salesforceplugin), [Remove-SalesforcePluginAllowlist](#remove-salesforcepluginallowlist), [Reset-SalesforcePlugins](#reset-salesforceplugins), [Test-SalesforcePluginSignature](#test-salesforcepluginsignature), [Uninstall-SalesforcePlugin](#uninstall-salesforceplugin), [Update-SalesforcePlugins](#update-salesforceplugins)

### Add-SalesforcePluginAllowlist

#### Synopsis

Allows plugins that Salesforce has not signed to be installed.

#### Syntax

```powershell
Add-SalesforcePluginAllowlist [-Name] <String[]> [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins trust allowlist add. This lowers a safety check of the CLI: a plugin on the allowlist installs without a Salesforce signature, so only add a plugin whose code you trust. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-Name` (String[], required): Plugins to allow, as npm package names. Each is passed to sf as its own --name. Passed to sf as --name. Required.
- `-NoPrompt` (switch): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins trust allowlist add`

#### Examples

```powershell
PS> Add-SalesforcePluginAllowlist -Name my-company-plugin -WhatIf
```

Preview allowing a plugin.

#### Remarks

- To see the examples, type: "Get-Help Add-SalesforcePluginAllowlist -Examples"
- For more information, type: "Get-Help Add-SalesforcePluginAllowlist -Detailed"
- For technical information, type: "Get-Help Add-SalesforcePluginAllowlist -Full"
- For online help, type: "Get-Help Add-SalesforcePluginAllowlist -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-trust>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Find-SalesforcePlugins

#### Synopsis

Lists third-party plugins you can install.

#### Syntax

```powershell
Find-SalesforcePlugins [<CommonParameters>]
```

#### Description

Runs sf plugins discover and returns the third-party plugins that Salesforce lists. It reads a list on the internet and changes nothing. Install one with Install-SalesforcePlugin.

#### Salesforce CLI

- `sf plugins discover`

#### Examples

```powershell
PS> Find-SalesforcePlugins
```

The plugins you can add.

#### Remarks

- To see the examples, type: "Get-Help Find-SalesforcePlugins -Examples"
- For more information, type: "Get-Help Find-SalesforcePlugins -Detailed"
- For technical information, type: "Get-Help Find-SalesforcePlugins -Full"
- For online help, type: "Get-Help Find-SalesforcePlugins -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-marketplace>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforcePluginAllowlist

#### Synopsis

Lists the plugins the CLI is allowed to install without a Salesforce signature.

#### Syntax

```powershell
Get-SalesforcePluginAllowlist [<CommonParameters>]
```

#### Description

Runs sf plugins trust allowlist list. Plugins on the allowlist can be installed even though they are not signed by Salesforce. It only reads.

#### Salesforce CLI

- `sf plugins trust allowlist list`

#### Examples

```powershell
PS> Get-SalesforcePluginAllowlist
```

The allowed unsigned plugins.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforcePluginAllowlist -Examples"
- For more information, type: "Get-Help Get-SalesforcePluginAllowlist -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePluginAllowlist -Full"
- For online help, type: "Get-Help Get-SalesforcePluginAllowlist -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-trust>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforcePluginDetails

#### Synopsis

Shows the installation details of plugins.

#### Syntax

```powershell
Get-SalesforcePluginDetails [-Name] <String[]> [-ExtendedDetails] [<CommonParameters>]
```

#### Description

Runs sf plugins inspect for each plugin and returns what the CLI knows about it, such as its version and where it is installed. It only reads. For the list of installed plugins see Get-SalesforcePlugins.

#### Parameters

- `-Name` (String[], required): Plugins to inspect, as npm package names such as @salesforce/plugin-agent. Required.
- `-ExtendedDetails` (switch): Show more detail. Adds --verbose.

#### Salesforce CLI

- `sf plugins inspect`

#### Examples

```powershell
PS> Get-SalesforcePluginDetails -Name @salesforce/plugin-agent
```

Version and location of one plugin.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforcePluginDetails -Examples"
- For more information, type: "Get-Help Get-SalesforcePluginDetails -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePluginDetails -Full"
- For online help, type: "Get-Help Get-SalesforcePluginDetails -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/@oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Get-SalesforcePlugins

#### Synopsis

Lists the Salesforce CLI plugins that are installed.

#### Syntax

```powershell
Get-SalesforcePlugins [-IncludeCore] [<CommonParameters>]
```

#### Description

Runs sf plugins and returns the CLI's own text output, one plugin per line. Add -IncludeCore to include the plugins that ship with the CLI.

#### Parameters

- `-IncludeCore` (switch): Also list the plugins that ship with the Salesforce CLI. Adds --core.

#### Salesforce CLI

- `sf plugins`

#### Examples

```powershell
PS> Get-SalesforcePlugins -IncludeCore
```

Every plugin, including the bundled ones.

#### Remarks

- To see the examples, type: "Get-Help Get-SalesforcePlugins -Examples"
- For more information, type: "Get-Help Get-SalesforcePlugins -Detailed"
- For technical information, type: "Get-Help Get-SalesforcePlugins -Full"
- For online help, type: "Get-Help Get-SalesforcePlugins -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Install-SalesforcePlugin

#### Synopsis

Installs a Salesforce CLI plugin (sf plugins install).

#### Syntax

```powershell
Install-SalesforcePlugin [-Name] <String> [-Force] [-Silent] [-ExtendedDetails] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

A plugin is code that runs with your permissions, so install only plugins you trust: the CLI may ask you to confirm one that is not on its allow list. -Name is an npm package name (optionally scoped and with a version, such as @salesforce/plugin-agent@latest) or a GitHub URL. A value that starts with a dash or contains spaces or control characters is refused, so it cannot be read as a CLI option. Supports -WhatIf and -Confirm.

#### Parameters

- `-Name` (String, required): The plugin to install: an npm package name such as @salesforce/plugin-agent, optionally with a version, or a GitHub URL. A value that starts with a dash or contains spaces or control characters is refused, so it cannot be read as a CLI option. Required.
- `-Force` (switch): Make npm fetch the plugin again even if a copy is already on disk. Adds --force.
- `-Silent` (switch): Silence the output of npm. Adds --silent.
- `-ExtendedDetails` (switch): Show the verbose output of npm. Adds --verbose.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins install`

#### Examples

```powershell
PS> Install-SalesforcePlugin -Name @salesforce/plugin-agent -WhatIf
```

#### Remarks

- To see the examples, type: "Get-Help Install-SalesforcePlugin -Examples"
- For more information, type: "Get-Help Install-SalesforcePlugin -Detailed"
- For technical information, type: "Get-Help Install-SalesforcePlugin -Full"
- For online help, type: "Get-Help Install-SalesforcePlugin -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Remove-SalesforcePluginAllowlist

#### Synopsis

Takes plugins off the allowlist of unsigned plugins.

#### Syntax

```powershell
Remove-SalesforcePluginAllowlist [-Name] <String[]> [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins trust allowlist remove. The plugins can no longer be installed without a Salesforce signature. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-Name` (String[], required): Plugins to remove from the allowlist. Each is passed to sf as its own --name. Passed to sf as --name. Required.
- `-NoPrompt` (switch): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins trust allowlist remove`

#### Examples

```powershell
PS> Remove-SalesforcePluginAllowlist -Name my-company-plugin -WhatIf
```

Preview taking a plugin off the list.

#### Remarks

- To see the examples, type: "Get-Help Remove-SalesforcePluginAllowlist -Examples"
- For more information, type: "Get-Help Remove-SalesforcePluginAllowlist -Detailed"
- For technical information, type: "Get-Help Remove-SalesforcePluginAllowlist -Full"
- For online help, type: "Get-Help Remove-SalesforcePluginAllowlist -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-trust>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Reset-SalesforcePlugins

#### Synopsis

Removes every plugin you installed or linked in the Salesforce CLI.

#### Syntax

```powershell
Reset-SalesforcePlugins [-Hard] [-Reinstall] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins reset. All user-installed and linked plugins are uninstalled, so commands that came from them stop working until you install them again (or use -Reinstall). Plugins that ship with the CLI stay. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-Hard` (switch): Also delete node_modules and the package manager files, not only uninstall the plugins. Adds --hard.
- `-Reinstall` (switch): Install all the plugins again after removing them. Adds --reinstall.
- `-NoPrompt` (switch): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins reset`

#### Examples

```powershell
PS> Reset-SalesforcePlugins -Reinstall -WhatIf
```

Preview a clean reinstall of the plugins.

#### Remarks

- To see the examples, type: "Get-Help Reset-SalesforcePlugins -Examples"
- For more information, type: "Get-Help Reset-SalesforcePlugins -Detailed"
- For technical information, type: "Get-Help Reset-SalesforcePlugins -Full"
- For online help, type: "Get-Help Reset-SalesforcePlugins -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/@oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Test-SalesforcePluginSignature

#### Synopsis

Checks the digital signature of an npm plugin package.

#### Syntax

```powershell
Test-SalesforcePluginSignature [-Npm] <String> [[-Registry] <String>] [<CommonParameters>]
```

#### Description

Runs sf plugins trust verify, which checks that the signature of the npm package matches the signature and key stored at the URLs the CLI expects. It tells you whether the plugin is signed by Salesforce before you install it. It only reads.

#### Parameters

- `-Npm` (String, required): The npm package name, which can include a tag or version, for example @salesforce/plugin-agent@latest. Passed to sf as --npm. Required.
- `-Registry` (String): The npm registry to use. It must be an absolute https:// URL. The CLI default is the registry npm uses. Passed to sf as --registry.

#### Salesforce CLI

- `sf plugins trust verify`

#### Examples

```powershell
PS> Test-SalesforcePluginSignature -Npm @salesforce/plugin-agent
PS> Is the package signed?
```

#### Remarks

- To see the examples, type: "Get-Help Test-SalesforcePluginSignature -Examples"
- For more information, type: "Get-Help Test-SalesforcePluginSignature -Detailed"
- For technical information, type: "Get-Help Test-SalesforcePluginSignature -Full"
- For online help, type: "Get-Help Test-SalesforcePluginSignature -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/plugin-trust>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Uninstall-SalesforcePlugin

#### Synopsis

Removes plugins from the Salesforce CLI.

#### Syntax

```powershell
Uninstall-SalesforcePlugin [-Name] <String[]> [-ExtendedDetails] [-NoPrompt] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins uninstall for each name. Commands the plugin provided stop working, and psfdx cmdlets that need it (for example the agent cmdlets need @salesforce/plugin-agent) will say it is missing. Asks for confirmation and supports -WhatIf; -NoPrompt skips the question. The CLI command has no prompt of its own.

#### Parameters

- `-Name` (String[], required): Plugins to remove, as npm package names such as @salesforce/plugin-agent. Each must be a plain name: it must not start with a dash or contain spaces. Required.
- `-ExtendedDetails` (switch): Show more detail of what the CLI does. Adds --verbose.
- `-NoPrompt` (switch): 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.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins uninstall`

#### Examples

```powershell
PS> Uninstall-SalesforcePlugin -Name @salesforce/plugin-agent -WhatIf
```

Preview removing a plugin.

#### Remarks

- To see the examples, type: "Get-Help Uninstall-SalesforcePlugin -Examples"
- For more information, type: "Get-Help Uninstall-SalesforcePlugin -Detailed"
- For technical information, type: "Get-Help Uninstall-SalesforcePlugin -Full"
- For online help, type: "Get-Help Uninstall-SalesforcePlugin -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/salesforcecli/@oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>

### Update-SalesforcePlugins

#### Synopsis

Updates the installed Salesforce CLI plugins.

#### Syntax

```powershell
Update-SalesforcePlugins [-ExtendedDetails] [-WhatIf] [-Confirm] [<CommonParameters>]
```

#### Description

Runs sf plugins update. Supports -WhatIf and -Confirm.

#### Parameters

- `-ExtendedDetails` (switch): Show the verbose output of the update. Adds --verbose.
- `-WhatIf` (switch): 
- `-Confirm` (switch): 

#### Salesforce CLI

- `sf plugins update`

#### Examples

```powershell
PS> Update-SalesforcePlugins -WhatIf
```

Show what would be updated.

#### Remarks

- To see the examples, type: "Get-Help Update-SalesforcePlugins -Examples"
- For more information, type: "Get-Help Update-SalesforcePlugins -Detailed"
- For technical information, type: "Get-Help Update-SalesforcePlugins -Full"
- For online help, type: "Get-Help Update-SalesforcePlugins -Online"

#### Related Links

- <https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference.html>
- <https://github.com/oclif/plugin-plugins>
- <https://github.com/tonygward/psfdx/blob/main/docs/cli-parity.md>
- <https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters>
