none
How to import hyper-v module on Windows 2008 and 2008 R2

Answers

  • Managing Hyper-V directly you must go through the WMI API.  So your PowerShell script is basically manipulating Hyper-V through WMI.

    That being said there is a community library of PoSh cmdlets - http://pshyperv.codeplex.com/

    The other PowerShell option involves SCVMM.  Since the SCVMM API is PowerSehll you are using the SCVMM cmdlets directly and SCVMM manages the various job actions.

    The last option is to manage your server like a Windows Core instalaltion and use all the various commaond line utilities - netsh, diskpart, etc. to manage the Hyper-V Server itself.  Which you still might need to do for some low level server configuration that is not available through WMI.

    That being said - manging a Hyper-V Server is a combination of Windows Core and Hyper-V - some things are in the Hyper-V namespace, some are in Failover Clustering, some are in Disk and Sotrage management.  It all depends on what you are trying to do, since it is built using Windows Core.


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Tuesday, May 10, 2011 7:09 PM
    Moderator

All replies

  • What error do you get ?

    I get an error when the pshyperv cmd install script tries to enable the powershell feature, but i already have it enabled and after it has been installed i can use the cmdlets in powershell..

    why do you want a host with hyper-v 2008?

    //Niklas

    Tuesday, May 10, 2011 1:04 PM
  • Managing Hyper-V directly you must go through the WMI API.  So your PowerShell script is basically manipulating Hyper-V through WMI.

    That being said there is a community library of PoSh cmdlets - http://pshyperv.codeplex.com/

    The other PowerShell option involves SCVMM.  Since the SCVMM API is PowerSehll you are using the SCVMM cmdlets directly and SCVMM manages the various job actions.

    The last option is to manage your server like a Windows Core instalaltion and use all the various commaond line utilities - netsh, diskpart, etc. to manage the Hyper-V Server itself.  Which you still might need to do for some low level server configuration that is not available through WMI.

    That being said - manging a Hyper-V Server is a combination of Windows Core and Hyper-V - some things are in the Hyper-V namespace, some are in Failover Clustering, some are in Disk and Sotrage management.  It all depends on what you are trying to do, since it is built using Windows Core.


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Tuesday, May 10, 2011 7:09 PM
    Moderator
  • Let's assume you've correctly installed PoerShell 2.0.  The easiest way to import a module is to copy it to your modules directory (c:\windows\system32\windowsPowerShell\v1.0\modules).  Take the PSHyperV zip that you download from codeplex, right click on it, then unblock it.  Next, inside the zip, copy the HyperV folder to your modules directory.

     

    Now you can either right click the PwerShell icon and select import system modules, or simply use "import-module hyperv" in your scripts.

     

     

    Tuesday, May 10, 2011 10:07 PM
  • Hi,

     

    If you just want to manage the remote Hyper-V host machines, you can also use Hyper-V Manager to get it, except PowerShell.

     

    For more information, you can refer to:

     

    Configure Hyper-V Remote Management in seconds

    http://blogs.technet.com/jhoward/archive/2008/11/14/configure-hyper-v-remote-management-in-seconds.aspx

     

    How to configure Hyper-V Remote Management

    http://social.technet.microsoft.com/wiki/contents/articles/how-to-configure-hyper-v-remote-management.aspx

     

    Install and Configure Hyper-V Tools for Remote Administration

    http://technet.microsoft.com/en-us/library/cc794756%28WS.10%29.aspx

     

     

    Best Regards,

    Vincent Hu

     

    Wednesday, May 11, 2011 6:31 AM
    Moderator
  • Let's assume you've correctly installed PoerShell 2.0.  The easiest way to import a module is to copy it to your modules directory (c:\windows\system32\windowsPowerShell\v1.0\modules).  Take the PSHyperV zip that you download from codeplex, right click on it, then unblock it.  Next, inside the zip, copy the HyperV folder to your modules directory.

     

    Now you can either right click the PwerShell icon and select import system modules, or simply use "import-module hyperv" in your scripts.

     

     

    Thanks, this helped. 

    James Snarey

    Tuesday, July 17, 2012 9:10 PM