Link to home
Start Free TrialLog in
Avatar of Vas
VasFlag for United States of America

asked on

Powershell Hyper-V Module on Server 2012 R2

I don't use powershell very much and I don't know if it's just me - but it seems every time I need to use powershell (and I always happen to be on different versions of Windows server) that something is different and even though I documented how I did something last time, it simply doesn't work in all cases.

Here's where I'm stuck today...

I'm on a Windows Server 2012 R2 machine, it has the Hyper-V role installed (and has running VM machines)


I'm trying to get a list of all VM's and the virtual network that their NIC is connected to.

But my issue is at the very basics, I can't even get output from "Get-VM"

I type it in, and nothing happens (no error, but no output, I just end up at the next line)

PS C:\> Get-VM
PS C:\>


If I type this:
Get-Command –Module Hyper-V

I get a list of all the Cmdlet's, for example:


CommandType     Name                                               ModuleName
-----------     ----                                               ----------
Cmdlet          Add-VMDvdDrive                                     Hyper-V
Cmdlet          Add-VMFibreChannelHba                              Hyper-V
Cmdlet          Add-VMHardDiskDrive                                Hyper-V
Cmdlet          Add-VMMigrationNetwork                             Hyper-VCommandType     Name                                               ModuleName
-----------     ----                                               ----------
Cmdlet          Add-VMDvdDrive                                     Hyper-V
Cmdlet          Add-VMFibreChannelHba                              Hyper-V
Cmdlet          Add-VMHardDiskDrive                                Hyper-V
Cmdlet          Add-VMMigrationNetwork                             Hyper-V
...etc

Open in new window




Just in case, I also imported the Hyper-V module like this:

PS C:\> Import-Module “C:\Windows\system32\WindowsPowerShell\v1.0\Modules\Hyper-V\Hyper-V.psd1”
PS C:\>


Here is the Powershell version info:

PS C:\> $psversiontable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34011
BuildVersion                   6.3.9600.16394
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Open in new window




So what am I missing?  If the Hyper-V module wasn't installed I assume typing Get-VM would give me an error, but it doesn't, yet it doesn't give any output either.

Also, if you can advise on the full command to list all VM's and their virtual switches that would be helpful too.


Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Abdul Khadja Alaoudine
Abdul Khadja Alaoudine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vas

ASKER

OMG that was it thank you!

Wow Microsoft could have at least added some kind of permissions error instead of nothing, they have no issues spitting out errors in Powershell for everything else.


Thanks Abdul.