Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Powershell Hyper-V Module on Server 2012 R2

Posted on 2014-10-14
2
Medium Priority
?
610 Views
Last Modified: 2014-11-12
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
0
Comment
Question by:Vas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
Abdul Khadja Alaoudine earned 2000 total points
ID: 40379666
Are you running PowerShell as administrator? If not, make sure you running it as administrator.
0
 
LVL 1

Author Comment

by:Vas
ID: 40379698
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.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question