Nov 12

Set Default PSP for a SATP with PowerCLI

Another in my series of scripts to help with vSphere implementations. This script uses the PowerCLI cmdlet Get-EsxCli to execute the esxcli command to set the default PSP policy ($defaultpsp) for the specified SATP ($satp) on each host in connected vCenter inventory.

Just set the $defaultpsp to the required PSP and set $satp to the SATP that the PSP will be set on. Once the variable have been set connect to vCenter using Connect-VIServer and execute the script. The script uses Get-VMHost to retrieve the list of hosts in the connected vCenter inventory then uses Get-EsxCli to set the default PSP for the configured SATP on each host.

The script as it is configured below sets the VMW_SATP_DEFAULT_AA to the PSP VMW_PSP_RR.

# Change the Default PSP for a SATP
# PowerCLI Session must be connected to vCenter Server using Connect-VIServer

# Define the default PSP to set VMW_PSP_MRU, VMW_PSP_RR, VMW_PSP_FIXED
$defaultpsp = "VMW_PSP_RR"

# Define the SATP to Set Default PSP to $defaultpsp
# This will depend on the SATP used associated with the connected array
# For example the SATP for an EMC VNXe is VMW_SATP_DEFAULT_AA

$esxHosts = Get-VMHost

foreach ($esx in $esxHosts) {

   Write-Host "Setting Default PSP to $defaultpsp for SATP $satp on $esx" -ForegroundColor green

   $esxcli = Get-EsxCli -VMHost $esx

Write-Host "Done!" -ForegroundColor green

Saves a lot of time since you do not have to connect directly to each host either by SSH, ESXi Shell, or using esxcli remotely to configure each host.

As always comments or recommendations for improvement are always welcome.

About the author


Hersey Cartwright is an IT professional with extensive experience designing, implementing, managing, and supporting technologies that improve business processes. Hersey is Solutions Architect for SimpliVity covering Virginia, Washington DC, and Maryland. He holds the VMware Certified Design Expert (VCDX-DV #128) certification. Hersey actively participates in the VMware community and was awarded the VMware vExpert title in 2016, 2015, 2014, 2013, and 2012. He enjoys working with, teaching, and writing about virtualization and other data center technologies. Follow Hersey on Twitter @herseyc


  1. vikram

    Hello Hersey,
    How to get set PSP for a specific cluster?

    1. Nick Andreev

      Hi vikram, you can get the list of hosts for a specific cluster in the following way:

      # Get-Cluster “clusterName” | Get-VMHost

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

nineteen − five =