March 7, 2014 at 4:58 am #13617
I'm watching the PowerShell Jumpstart om MVA and I've been trying to get a list of services running on remote computers:
and I always get the error message: Cannot open Service Control Manager on computer
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.
Thanks for any help in advance!
March 7, 2014 at 5:19 am #13618
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:
Get-CimInstance -ClassName Win32_Service -ComputerName
March 7, 2014 at 6:31 am #13619
Thank you for your answer!
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 :)))
March 7, 2014 at 6:34 am #13620
What did you try? Configuring Windows Firewall, or using Get-CimInstance instead?
March 7, 2014 at 6:42 am #13621
Maybe I should join the other computer to the domain?? < Nice one 🙂 You could do some simple tests: – Connect to the target server in event viewer on the server you are running the powershell command from. – Browse to the target server in explorer – \\targetservername\c$ If RPC is open between the computers, both of these should work. Have you tried the otherway around? Cheers
March 7, 2014 at 7:42 am #13626
Thank you, it works now!
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.
Thanks a lot again! PS is amazing!
You must be logged in to reply to this topic.