VMware Cloud Community
jssidhu71
Contributor
Contributor
Jump to solution

Storage vmotion all vms resident on one datastore to another datastore

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
Jump to solution

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
Jump to solution

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
Jump to solution

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
Jump to solution

^^^^ 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
Jump to solution

Thanks Alan !!!

0 Kudos