Powershell – Enabling Powershell Remoting, Access is denied

powershellremote-access

I am trying to enable Powershell remoting on a Windows 2008 R2 Server, running in workgroup mode.

I ran the command Enable-PSRemoting in the PowerShell Console.

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"): y WinRM already is set up to receive requests on this machine. Set-WSManQuickConfig : Access is denied. At line:50 char:33
+             Set-WSManQuickConfig <<<<  -force
    + CategoryInfo          : InvalidOperation: (:) [Set-WSManQuickConfig], InvalidOperationException
    + FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.SetWSManQuickConfigCommand

I am logged in as a member of the Administrators Group, and running the Console As Administrator.

Best Answer

Just ran into and solved this problem on a couple of systems. In this particular case, these two systems were not part of a domain, and the user account was not the original "Administrator" account, but rather a newer account that was also a member of the local Administrators group.

The solution came from the following blog post I wandered across: WinRM Access is Denied on Local Computer. In short, run the following from a command prompt (launched as Administrator):

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

After that, re-launch the PowerShell prompt as admin and re-run Enable-PSRemoting, that simple.