Getting Powershell Management Library for Hyper-V (PSHyper-V) up and running

One of the great capabilities of Powershell is the ability to extend its’ functionality through new libraries. One I am currently playing with is the Powershell Management Library for Hyper-V, or PSHyper-V. For Server Core and Hyper-V Server users, the cmdlets contained within this library add a new dimension of functionality and capabilities, and enable admins to reduce their reliance on Hyper-V manager to perform otherwise simple tasks.

Although you can load the library upon demand, there is another method available whereby it may be preloaded as part of your windows profile.

  1. Download the latest recommended release of PSHyper-V from http://www.codeplex.com/PSHyperv
  2. Copy the contents of the ZIP archive onto your Hyper-V server. In my instance, these were to a folder called c:\powershell
  3. To get your profile path, type the following from with a Powershell prompt:

    $profile

    You will typically get something like:

    C:\Users\your_user_name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

  4. The file Microsoft.PowerShell_profile.ps1 is the Powershell script that is executed upon the startup of any Powershell prompt for your user account. In most circumstances, this script doesn’t exist, so you will need to create it (it is worth checking first). To create the script, enter the following into a Powershell prompt

    new-item $profile -itemtype file -force

  5. Now edit this file and add the path to PSHyper-V.ps1 into it. In my example, this is as follows:

    . c:\powershell\PSHyper-V.psq

    Note the dot-space prior to the file path. This is required to execute the script.
    (Editing this file on server core or Hyper-V server can be a bit of trial. In the end, I did it remotely.)

  6. That’s it. To test it, either start a new Powershell prompt. If all is well, a list of the loaded PSHyper-V cmdlets will be shown.

Thanks to the author of the Technet blog post from which I have sourced most of the information for this.

1 thought on “Getting Powershell Management Library for Hyper-V (PSHyper-V) up and running

  1. Pingback: Automatically Loading PSHyperV Library - CrossNotes

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.