chandlm
Expert
Expert

Remove/add all VMs in an environment

I know the solution is probably here somewhere but I have searched for a while at this point and haven't found it.  Basically all I need to do is run through all of the VMs in an environment and remove them from inventory, then add them right back (don't want to delete anything from disk).  I don't think I need many of the things in the scripts I have been trying to piece together because I don't care about resource pools, folders, etc..  I'm only doing this to break the connection/dependency on vCD in the environment.

I've found scripts to remove them all but I haven't tested them yet just because I want to be able to test the removal/addition at once.

Any help?  Obviously I'm still pretty much a novice with PowerCLI so try not to judge me too harshly Smiley Happy.

0 Kudos
2 Replies
LucD
Leadership
Leadership

Isn't a Remove-VM with the Deletepermanently switch on $false sufficient ?

And you register the VM again with the New-VM and the VmFilePath parameter.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

chandlm
Expert
Expert

I actually realized this still won't work as the VMs are powered on.  I decided I can accomplish nearly the same thing by disconnecting/removing the hosts one at a time then adding them back.  Thanks for trying to help out though.

0 Kudos