VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

move vm folder from one lun to another lun

how do I move a vm folder in a lun to another lun in a remote dc with powercli?

the vm is not registered in vc

0 Kudos
1 Solution

Accepted Solutions
mattboren
Expert
Expert
Jump to solution

Hello, tdubb123-

You could use the Copy-DatastoreItem cmdlet from PowerCLI, which has a "-Recurse" parameter for copying all the children items.  For example:

Copy-DatastoreItem -Item "vmstore:\myDatacenter0\myDatastore0\someVMFolder0\" -Destination "vmstore:\myDatacenter3\myDatastore2\" -Recurse

This utilizes the PSDrive "vmstore:\", which provides access to the datacenters/datastores of the default VIServer connection.  If you need to go between vCenters, you can use the "vmstores:\" PSDrive, which provides access to these items in all VIServers to which you are connected in that particular PowerCLI session.

Once you are satisfied with the integrity of the files after the copy, you can remove the folder of items from the original location using the standard Remove-Item cmdlet.  Enjoy.

View solution in original post

0 Kudos
4 Replies
mattboren
Expert
Expert
Jump to solution

Hello, tdubb123-

You could use the Copy-DatastoreItem cmdlet from PowerCLI, which has a "-Recurse" parameter for copying all the children items.  For example:

Copy-DatastoreItem -Item "vmstore:\myDatacenter0\myDatastore0\someVMFolder0\" -Destination "vmstore:\myDatacenter3\myDatastore2\" -Recurse

This utilizes the PSDrive "vmstore:\", which provides access to the datacenters/datastores of the default VIServer connection.  If you need to go between vCenters, you can use the "vmstores:\" PSDrive, which provides access to these items in all VIServers to which you are connected in that particular PowerCLI session.

Once you are satisfied with the integrity of the files after the copy, you can remove the folder of items from the original location using the standard Remove-Item cmdlet.  Enjoy.

0 Kudos
tdubb123
Expert
Expert
Jump to solution

thank you. this works great

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You forgot your "How does that do for you ?" signature Smiley Wink


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

0 Kudos
mattboren
Expert
Expert
Jump to solution

Ha, yes indeed.  After so many times of not getting an answer to that sign-off, I guess I need not append it.  Or, maybe I'll put it in my actual signature so as to always have it... :smileygrin:

0 Kudos