Config Server Firewall

PowerShell: How to Fix The RPC server is unavailable, and Access is denied Errors

This tutorial provides step-by-step instructions on how to solve the following two PowerShell Errors: The RPC server is unavailable; Access is denied.

The RPC server is unavailable
Cannot establish the WMI connection to the computer

Both errors happen when you try to run commands on remote computers using the -ComputerName parameter. And both errors are related to the Windows Management Instrumentation service.

And let's see how to fix them.

The RPC server is unavailable

I got the following error message when I tried to rename a remote computer using the Rename-Computer cmdlet:

Rename-Computer : Cannot establish the WMI connection to the computer '192.168.100.10' with the following error message: The RPC server is unavailable.

The problem has to do with the firewall configuration on the remote computer. We can fix it by allowing WMI traffic through the firewall.

To allow WMI traffic, run the following PowerShell command as Administrator (on the remote computer):

Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"

That should solve the problem. If you want to disable the above firewall rule, run the following PowerShell command:

Disable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"

How to Fix Access is denied Error

This error happens when you try to run a PowerShell command on a remote computer using the -Credential and -LocalCredential parameters. For example, I received the following message when I tried a restart a remote computer:

Restart-Computer : Failed to restart the computer 192.168.100.10 with the following error message: Access is denied.

We can solve this problem by disabling UAC remote restrictions. The following command does that:

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "LocalAccountTokenFilterPolicy" -Value 1

If you want to re-enable UAC remote restrictions, run the following command:

Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "LocalAccountTokenFilterPolicy" -Value 0

And that is for this tutorial.