Need help to Export,Import, Rename VHDs as per VM Name

Feb 23, 2012 at 6:36 PM


I am new to Power Shell. I am looking for a script/Commands for below tasks.

  1. Disconnect All VHDs
  2. Export VM
  3. Import VM with New NAME
  4. Move VHDs to exported VM folder
  5. Rename the VHDs as per new VM Name
  6. Re Attach all VHDs to new VM

 This will save my life in our day to day activity alot. Any help would be highly appreciated......

 As of now we are using below manual process

  • 1. Create a new folder(named the name you want to rename)
  • 2. Export the VMs to this folder
  • 3. Import the VMs in the new created folder.(You can delete the original VMs)