JonathanX11 on Mon, 03 Jul 2017 14:50:34


I have got a strange one with GetVm.

I can run the command below against another Hyper-V server (Windows 2012 R2) , say Machine B and it works, but if I run it against the machine I am logged into (Say machine A) then it doesn't return any information.  Likewise if I run on Machine B against A it returns VM information but if I run on B against B it returns no information.

It smells like a firewall problem but on affecting the local command execution against the Hyper-V on the local host.

It's driving me a bit crazy mad.

1) Working Get-VM (lookin at a remote Hyper-V hostname)

2) Not Working Get-Vm (looking at local hyper-v hostname)

Host Operating Systems: Windows 2012 R2 and 1 windows 2016 (although I haven't tested this yet).

VM Guest Operating Systems: Windows 7 Ultimate and Windows 10 Enterprise

Any ideas?




CHEEKATLAPRADEEP-MSFT on Tue, 04 Jul 2017 05:22:56

To enable remote PowerShell management, logon to the remote server, open PowerShell (run as an Administrator) and run the following command:

Enable-PSRemoting –Force

For more details, refer “How to run PowerShell commands against a remote VM”.

Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

JonathanX11 on Tue, 04 Jul 2017 10:56:07


Thanks for your response.

I ran the code and got the message below

However, out of curiosity I thought I'd try the Get-Vm on the local machine anyhow; and it only worked!!

Thanks!  Not idea why it wasn't working but running the PSRemoting must have reset something for the local connections.

Going to now test it on the Hyper-V servers and fingers crossed it'll work on them too.

Should this keep working (not withstanding Windows updates, etc.) or might it need running after reboots, etc?

Thanks Again.


JonathanX11 on Tue, 04 Jul 2017 11:16:35


It is looking like Get-Vm will only work on the ISE on which the Enable-PSRemoting was run.

I am starting to think something isn't right here.

The fact that Get-Vm works on the local hyper-v host if I run the PSremoting code first must mean something is defaulting to no access on the local machine but is reset by setting the remoting in an ISE session; although the Get-Vm only works in the ISE in which I have run the remoting code.  If I start a new ISE windows after running the remoting code on another ISE window then it does not work (as in my first question item (2) ).

Thanks for the step forward.

Any more ideas what's stopping this working fully?


CHEEKATLAPRADEEP-MSFT on Wed, 05 Jul 2017 02:40:38

Could you try “Run PowerShell as an administrator” and execute the cmdlet?


Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members

JonathanX11 on Tue, 11 Jul 2017 12:21:55


This looks like it works when the ISE is fired up as administrator.

What are the permission requirements regards local execution and remote execution on the same domain account?



CHEEKATLAPRADEEP-MSFT on Wed, 12 Jul 2017 04:43:26

Glad to know that your issue has been resolved.

The Get-ExecutionPolicy cmdlet gets the execution policies for the current session.

The execution policy is determined by execution policies that you set by using Set-ExecutionPolicy and the Group Policy settings for the Windows PowerShell execution policy. The default value is Restricted.

For more details, refer “Get-ExecutionPolicy”.
Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.