Getting List of Services from Remote Computers

This topic contains 5 replies, has 3 voices, and was last updated by  Istvan Szarka 4 years, 4 months ago.

  • Author
  • #13617

    Istvan Szarka


    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

    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!


  • #13618

    Dave Wyatt

    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 
  • #13619

    Istvan Szarka

    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 :)))

  • #13620

    Dave Wyatt

    What did you try? Configuring Windows Firewall, or using Get-CimInstance instead?

  • #13621

    Tore Groneng


    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

  • #13626

    Istvan Szarka

    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.