vCenter PowerShell PowerCLI command to to change a VMDK disk from non-persistent to persistent without powering down the VM

While I am certain this already posted on the net in a few places, I wanted to capture it here, as it is a question I get asked often by customers. Especially seeing as the manual method requires shutting down a VM to make the change.


Just replace the text <vcenter_dns_or_ipaddress> with the IP address or FQDN of the vCenter host. You will be prompted to login to vCenter, and will require enough privileges to modify the VM you need to edit.

connect-viserver <vcenter_dns_or_ipaddress>

Then replace the <vm_name> with the name of the virtual machine you wish to change one or many of its disks to Independent Persistent. It will provide multiple prompts based on how many disks the VM has, and ask you to confirm each one individually, or all if desired.

Get-HardDisk -VM <vm_name> | Set-HardDisk -Persistence "IndependentPersistent"

Then if required, run the command below to change the disk back to Persistent, and again select Y for each disk you want set back.

Get-HardDisk -VM <vm_name> | Set-HardDisk -Persistence "Persistent"