I’m watching the PowerShell Jumpstart om MVA and I’ve been trying to get a list of services running on remote computers:
Get-Service -Computername <romote computer name>
and I always get the error message: Cannot open Service Control Manager on computer <name>
Both computers are Windows Server 2012 R2 machines.
I’ve found out that the user performing the query has to be a member of the local Administrators group on the remote computer.
I took care of it with a GPO by adding my domain Administrator’s account to the built-in Administrators group using the “Create” option.
The thing still doesn’t work and I’ve been unable to find further help.
I believe Get-Service uses RPC, and Windows Firewall may be preventing that traffic by default. There are three rules that you can enable in Windows Firewall to allow this traffic:
Remote Service Management (NP-In)
Remote Service Management (RPC)
Remote Service Management (RPC-EPMAP)
Alternatively, you could use WinRM / PSRemoting, which should be enabled by default on Server 2012 or later. The simplest way of accomplishing this is with the Get-CimInstance cmdlet targeting the Win32_Service WMI class:
I have tried it and still nothing. The help file for Get-Service has this example:
"PS C:>get-service -computername Server02
This command gets the services on the Server02 remote computer.
Because the ComputerName parameter of Get-Service does not use Windows PowerShell remoting, you can use this parameter even if the co
mputer is not configured for remoting in Windows PowerShell."
It should just work as smoothly as in the video. I’m sure I’m the one who’s screwing up something, but I don’t know what.
Maybe I should join the other computer to the domain?? I’m joking, already done it :)))
The problem was of course me screwing up the GPO’s security filtering by removing the Authenticated Users.
I restored it and it fixed the problem. I’m not sure if the firewall settings or the group membership setting were the solution - I configured both in the GPO -, but it will now be easy to find out.