Your best source of information and news about hardware, BIOS and vista on the internet

Vista ARTICLES TOP 50 Spyware Virus Vista SOFT Vista HELP

More PowerShell in R2 tricks


The other day, Ben Armstrong posted the steps for installing Windows PowerShell on Hyper-V Server 2008 R2.  How awesome is that?  A real, modern, powerful shell on Hyper-V Server!

It should be noted that this also works on Windows Server 2008 R2 Core SKUs, so if you’re running Hyper-V on one of those, you can also use this trick.

So why is this cool?

Well, first of all, if you install PowerShell on a Server Core SKU, you can use a new and more powerful tool for installing and configuring server roles and features.

To do this, you need to load the Server Manager module into your shell with the following command:

Import-Module ServerManager

You can get a list of the new cmdlets that this module provides by running:

Get-Module ServerManager

So, if you’re on a Windows Server SKU, you can install all of your roles or features this way.  To install Hyper-V, you would use this command:

Add-WindowsFeature Hyper-V

Ok, that’s cool and all, but it’s not that spectacular.  So how about being able to actually interact with Hyper-V from this shell?  Even on Server Core or Hyper-V Server 2008 R2?

Check out James O’Neill’s PSHyperV project over on CodePlex.  If you download this library, you can interact with Hyper-V directly from your Core console. 

The first thing to remember is that you need to dot-source the HyperV.ps1 script so that all of the functions remain in memory, like so:

. .\hyperv.ps1

After you do that, you’ll get a list of all of the new functions and filters that this library provides.  Just as an example, you can create and configure a VM with these commands:

$vm = New-VM -name “MyVM”
Set-VMMemory -vm $vm -memory 2GB
Set-VMCPUCount -vm $vm -CPUCount 2
# some other logic to create a hard drive, or attach an existing one.
Start-VM -vm $vm -wait

Popularity: 1%


Written by mikekol. Read more great feeds at is source WEBSITE
no comments.
Read more articles on Hyper-V How To and otherSoftware and Microsoft Hyper-V and Miscellaneous V.

Related articles

No comments

There are still no comments on this article.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .