Reputation: 3871
I'm writing a powershell script that will start/stop hyper-v VM's but it gave this message:
The term 'Get-VM' is not recognized as the name of a cmdlet, function, script file, or operable program
I found this helpful link:
http://social.technet.microsoft.com/Forums/windowsserver/en-US/07decd82-270e-4dd0-b8e8-789d693099dd/powershell-getvm-error?forum=winserverpowershell enter link description here
Then I added import-module HyperV but get this message:
Import-Module: The specified module 'HyperV' was not loaded because no valid module file was found in any module directory at c:\scripts\startStopVMShell.ps1
I found a link that was helpful here: Power shell: Import-Module enter link description here
I tried this at the powershell cmd line:
Get-Module -listavailable
But it's not listing HyperV with any spelling.
I'm using Server 2008 R2. How do I get the HyperV module on my server? Or maybe I have it on my server but powershell is looking in the current directory instead of where the module is loaded?
Upvotes: 1
Views: 12058
Reputation: 2123
The Hyper-V Module for Windows PowerShell was introduced as part of the Windows Server 2012 OS. There is a CodePlex project under the "same" name that you might be able to port to 2008 R2.
PowerShell Management Library for Hyper-V
Let me know how that goes for you. Related blog post.
Upvotes: 1