jssidhu71
Contributor
Contributor

Storage vmotion all vms resident on one datastore to another datastore

Jump to solution

I need to Storage vmotion all vms resident on one datastore to another datastore within the same cluster. All VMS have one vmdk.. has anyone a script or done something similar..

0 Kudos
1 Solution

Accepted Solutions
alanrenouf
VMware Employee
VMware Employee

You should also be able to do:

Get-Datastore "OldDatastore" | Get-VM | Foreach { Move-VM -Datastore (Get-Datastore "NewDatastore") }

If you found this information useful, please consider awarding points for Correct or Helpful.

Alan Renouf

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com

View solution in original post

0 Kudos
4 Replies
mcowger
Immortal
Immortal

I've done this with a powersheel scrippt pretty simply...

Use halr9000's function here:

http://poshcode.org/575

And wrap it in something like this (pseudocode)

Get-Datastore (Name=whatever) | Get-VM | SVmotion-VM (get-datastore NewDS)

--M






--Matt

VCP, vExpert, Unix Geek

--Matt VCDX #52 blog.cowger.us
0 Kudos
alanrenouf
VMware Employee
VMware Employee

You should also be able to do:

Get-Datastore "OldDatastore" | Get-VM | Foreach { Move-VM -Datastore (Get-Datastore "NewDatastore") }

If you found this information useful, please consider awarding points for Correct or Helpful.

Alan Renouf

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
0 Kudos
mcowger
Immortal
Immortal

^^^^ Alan's way is better Smiley Happy

Use his.






--Matt

VCP, vExpert, Unix Geek

--Matt VCDX #52 blog.cowger.us
0 Kudos
jssidhu71
Contributor
Contributor

Thanks Alan !!!

0 Kudos