Powershell & HyperV - The easy way

Managing VMs from PowerShell requires the use of lots of WMI calls but fortunately for us James O'Neill has come to the rescue with a PowerShell script that makes managing HyperV as easy as the rest of PowerShell with straightforward commands like Get-VM. He has produced a PowerShell script much like an include file that you can use to make life easier.

The source is up on codeplex at http://www.codeplex.com/PSHyperv 

And for those who haven't figured out how to do an include in a PowerShell script here you go, you dot source it. Just add the following line to the top of your script.

. [path to script]\hyperv.ps1

Personally I have tinkered and removed the directory listing of all the added functions. Once I got used to the structure of the commands it saved me hundreds of lines of WMI handling and calls. The only task I haven't been able to get it to do is create the VM in a specific directory. I have now manged it with direct WMI calls so I'll go back and try with these extensions either to add to them or use them to manipulate what I need, but that will have to wait for a future post.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



 

Dilbert of the day