Install-SalesforceCli
Installs the Salesforce CLI (sfdx).
param([string]$Url = "https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-x64.exe")
#requires -version 5.1
try {
# Define the URL of the Salesforce CLI installer
# Define the output path for the downloaded installer
$output = "$env:USERPROFILE\Downloads\sfdx-windows-x64.exe"
# Download the installer
Invoke-WebRequest -Uri $url -OutFile $output
# Run the installer
Start-Process -FilePath $output -ArgumentList "/silent" -Wait
# Verify the installation
sfdx --version
Write-Output "Salesforce CLI installed successfully."
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}