We're looking for a script/command set to set specific drives to independent/persistent in our environment (~1000 hosts and 10,000+ VMs). We would prefer to have a feeder file with a list of targets that it will use to make this change. It would also need to not shut down the VM as part of this but let it wait (flags set) until the VM is powered off as part of a set schedule.
Hoping someone knows a good way to do this, IF it can be done.
Thanks.
Something like this?
Note that the VM needs to be powered off for this to work.
$hdName = 'Hard disk 2'
$vm = Get-VM -Name $vmName
$hd = Get-HardDisk -VM $vm -Name $hdName
Set-HardDisk -HardDisk $hd -Persistence IndependentNonPersistent -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
Confirmed that the machines need to be powered off for the change:
However I see posts back from 2011 that seem to indicate this used to work against live workloads? Was this changed?
Changing persistent <-> non-persistent disks
https://ict-freak.nl/2009/12/01/powercli-change-persistence-mode-on-the-fly/
Afaik this always required the VM to be powered off.
Neither of those 2 posts seems to say that the VM can be powered on.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference