v1.0.0 — latest release

Salesforce. Meet PowerShell.

Powerful Salesforce tools.
Familiar PowerShell commands.
One | away from anything.

Install-Module psfdx
Read the docs

PowerShell 7 on Windows, macOS and Linux, or Windows PowerShell 5.1. Commands that use sf require Salesforce CLI v2 or newer. Set up the CLI.

Sample session with made-up data. It is not a live org.

Example PowerShell session. Connect-Salesforce -Sandbox connects to a sandbox. Select-SalesforceRecords with a SOQL query then returns four Account records as a table of Id and Name.

  • Connect-Salesforce
  • Select-SalesforceRecords
  • Upsert-SalesforceRecord
  • Test-SalesforceFlow
  • Test-SalesforceApex
  • Get-SalesforceAlias
  • Update-SalesforceCli
  • Export-Csv

A simpler, more intuitive way to work with Salesforce.

psfdx brings the power of the Salesforce CLI into PowerShell, making everyday Salesforce development, administration and automation easier.

  • | pipeline

    Objects, not JSON

    Every command returns real PowerShell objects, not text to parse. Pipe them straight into Where-Object, Sort-Object, Group-Object or Export-Csv. No jq, no string handling.

  • win · mac · linux

    Runs everywhere

    PowerShell 7 on Windows, macOS and Linux. Windows PowerShell 5.1 is supported too.

  • Get-Command · Get-Help

    Everything is discoverable

    Get-Command and Get-Help are all you need to find every command and every parameter, with examples.

    PS> Get-Command -Module 'psfdx*'
    PS> Get-Help Deploy-SalesforceMetadata -Examples
  • save · deploy · test

    Deploy and test as you save

    Run Watch-SalesforceApex in your project. Every save deploys the change and runs its tests.

    PS> Watch-SalesforceApex
  • Claude Code · Agent Skills

    PSFDX Agent Skill

    Give Claude Code and compatible agents the PSFDX command for 17 everyday Salesforce tasks, plus the rules for checking the target org and asking before changes.

    Install the Agent Skill

Get started

PS> Install-Module psfdx
PS> Import-Module psfdx
PS> Get-Command -Module psfdx*

Set up Salesforce CLI

If sf is missing and Node.js and npm are on PATH, set $env:PSFDX_CLI_INSTALL = 'Prompt' to ask before installing. In CI, set it to Install to explicitly allow unattended installation. The default is Never. PSFDX leaves existing CLI installations alone.

1. Connect to your sandbox

PS> Connect-Salesforce -Sandbox

2. Explore built-in help

PS> Get-Help Select-SalesforceRecords -Full
NAME
    Select-SalesforceRecords

SYNOPSIS
    Runs a SOQL query and returns the records as objects.

SYNTAX
    Select-SalesforceRecords [[-Query] <String>] [[-File] <String>] [[-TargetOrg] <String>] ...

DESCRIPTION
    Runs sf data query with --query or --file. With the default -ResultFormat json
    the records are returned as objects without their attributes property ...

    ... additional parameters and examples omitted ...

Illustrative excerpt, shortened for readability. Run the command to view the complete installed help.

3. Export Salesforce records to CSV

PS> Select-SalesforceRecords `
    -Query 'SELECT Id, Name FROM Account LIMIT 10' `
    -TargetOrg myorg |
    Export-Csv -Path './accounts.csv' -NoTypeInformation

4. Update the entire suite

PS> Update-Module psfdx

Discover every command and parameter

Use Get-Command -Module psfdx to list the core cmdlets or Get-Command -Module 'psfdx*' to list all modules after Import-Module psfdx. PowerShell's built-in help includes descriptions, parameters, examples and the underlying sf mapping.

Further reference: repository command catalogue · Salesforce CLI parity report.

Install the PSFDX Agent Skill

With Node.js installed, run this from your project directory:

PS> npx skills add tonygward/psfdx --skill psfdx --agent claude-code

Run /psfdx in Claude Code. To install the skill across projects, add --global to the install command.

The npx command installs the skill and its offline command reference. For prerequisites, see the full installation guide.

Beyond Salesforce CLI

PSFDX goes beyond wrapping Salesforce CLI commands. It combines queries, metadata and structured PowerShell objects into higher-level workflows for Salesforce developers, administrators and architects.

Compare Salesforce environments

The problem: a release works in UAT but not in production, and you suspect the fields have drifted apart.

PS> Compare-SalesforceFields -SourceOrg uat -TargetOrg prod -ObjectName Account, Opportunity |
Format-Table ObjectName, FieldName, Difference, Property, SourceValue, TargetValue
ObjectName  FieldName           Difference      Property       SourceValue                  TargetValue
----------  ---------           ----------      --------       -----------                  -----------
Account     Customer_Tier__c    Changed         PicklistValues ["Gold","Platinum","Silver"] ["Gold","Silver"]
Account     Region__c           MissingInTarget Type           picklist
Opportunity Discount_Percent__c Changed         Precision      5                            3
Opportunity Partner_Code__c     Changed         Length         20                           10
Opportunity Partner_Code__c     Changed         Nillable       true                         false

Illustrative output from made-up orgs. Its shape and formatting are what the command returns.

One row per difference: fields missing from either org, and each changed property with both values. It only reads the orgs. With the CLI alone you would run sf sobject describe for each object in each org, then match the fields and compare the properties in your own script. See Compare-SalesforceFields, Compare-SalesforcePermissions and Compare-SalesforceMetadata.

PowerShell simplicity. Salesforce capability.

PowerShell 7 on Windows, macOS and Linux, or Windows PowerShell 5.1, with the Salesforce CLI installed.

PS> Install-Module psfdx
PS> Import-Module psfdx
PS> Connect-Salesforce -Sandbox