Author Posts

August 1, 2015 at 9:39 pm

Hi there, im unable to restart my VM (WIN7 32 BIT) from my host (win8 63 bit) I get error "PS C:\> Restart-Computer win7
Restart-Computer : Failed to restart the computer win7 with the following error message: Access is denied. (Exception
from HRESULT: 0x80070005 (E_ACCESSDENIED)).
At line:1 char:1
+ Restart-Computer win7

I had PS remoting enabled on bothe machines,however it still doesnt work. Could you please help!

Thank you

August 1, 2015 at 9:48 pm

Are you running your PowerShell prompt or ISE instance as Administrator?

August 1, 2015 at 9:51 pm

PowerShell prompt as Administrator

August 1, 2015 at 9:55 pm

Have you tried issuing the command along with the Credential parameter, like so:

Restart-Computer -Computer win7 -Credential Domain\Username

August 1, 2015 at 9:55 pm

Also, does this mean psremoting is enabled?
what does , WinRM already is set up to receive requests on this machine.
Set-WSManQuickConfig : Access is denied.
At line:50 char:33

PS C:\Windows\system32> Enable-PSRemoting

WinRM Quick Configuration
Running command "Set-WSManQuickConfig" to enable this machine for remote management through WinRM service.
This includes:
1. Starting or restarting (if already started) the WinRM service
2. Setting the WinRM service type to auto start
3. Creating a listener to accept requests on any IP address
4. Enabling firewall exception for WS-Management traffic (for http only).

Do you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a
WinRM already is set up to receive requests on this machine.
Set-WSManQuickConfig : Access is denied.
At line:50 char:33
+ Set-WSManQuickConfig <<<

August 1, 2015 at 9:57 pm

yes tried with the credential param, still doesnt work 🙁

August 2, 2015 at 4:22 am

Note that Restart-Computer doesn't use WinRM. Are you able to use Shutdown.exe? If not, there's a permissions or connectivity problem.

August 2, 2015 at 5:34 am

wow! reply from don jones himself 🙂

I'm unable to shutdown.exe either

PS C:\Windows\system32> shutdown.exe /s /m \\win7
win7: Access is denied.(5)

August 2, 2015 at 5:36 am

Your error output seems pretty clear, did you read it?

To clarify the question: Are you on some computer, trying to restart another computer (that happens to be a VM)?

Like Don mentioned, permissions or connectivity. Given that you're getting access denied, permissions seem likely...

Ignore the fact that this is a VM. How do you restart another computer? You need privileges to do this. Same deal here, doesn't matter if the VM is on your computer.

Unless your PowerShell session somehow has access to this remote computer (e.g. through domain privileges), you're not going to have access to restart it. If your hypervisor (Hyper-V?) supports it, you might be able to use a command like 'Restart-VM', that works around these privilege requirements by using an agent on the VM.

Cheers!

August 5, 2015 at 11:28 pm

true, that machine was out of domain, now I joined to domain and using get-cred it worked... thank you guys !!