VMware Solutions Discussions

Script to register vm's on a snapmirror



I was hoping someone could advise of a script or a util to register all the VM's into a ESX environment after snapmirror is broken to a DR site just to automate a timesink process.

Be nice if it had some sort of GUI that you could select just the ones you want, but anything would do nicely atm.

I expect this is a fairly common thing, so hopefully there is a fair bit of material around already instead of having to write my own.



Re: Script to register vm's on a snapmirror


I  have a few things over at my site: theselights.com .   The ESX to vSphere migration posts should have what you need.  Here is the VM registration piece:

#----{ Register VMs that were chosen to be migrated

Write-Host "Registering VMs to: " $newVC
Foreach ($vm in $vmsToMigrate) {

dir $storePath | where {$_.PSChildName -like "*$vm*"} | % { New-VM -vmhost $vSphereHost -VMFilePath $_.DatastoreFullPath } | Out-Null


The variables get set earlier in the script so I would recommend checking the full thing out.  There are other scripts on there that will break your SnapMirror, find all VMs on a datastore, etc.



NetApp Insights to Action
I2A Banner
All Community Forums