none
Get Status of Services from Remote Server

    Question

  • I'm just starting to learn PowerShell.  As a test, I would like to get the status of some services off a remote server.  I ran the following command:

    get-service -name network* -computername <Server Name>

     

    However, when executed the command returns:

     

    Get-Service : Cannot open Service Control Manager on computer '<Server Name>'. This operation might

    require other privileges.

    At line:1 char:12

    + get-service <<<<  -name network* -computername <Server Name>

        + CategoryInfo          : NotSpecified: (:) [Get-Service], InvalidOperationException

        + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.Get

       ServiceCommand

    I did some Googling and found articles indicating that the problem could be with firewall access for DCOM/RPC.  So I traced the route to the server and it's not going through a firewall.  I also checked the Windows firewall on both the server and the desktop, and it's disabled on both.

    My questions are:

    1. Am I using the correct command for my stated purpose?
    2. What besides firewall access might be causing the problem?

    Thanks for any help that you can provide!

    --Tom

    Friday, April 27, 2012 2:26 AM

Answers

  • First thing, are you a member of the Administrators group on the remote computer?

    If not, that would explain the error you are getting.

    Next thing, I don't have a service on my computer called Network or anything that starts with Network.

    I have:

    Stopped  Netlogon  Netlogon
    Running  Netman  Network Connections
    Stopped  NetMsmqActivator    Net.Msmq Listener Adapter
    Stopped  NetPipeActivator      Net.Pipe Listener Adapter
    Running  netprofm   Network List Service
    Stopped  NetTcpActivator     Net.Tcp Listener Adapter
    Stopped  NetTcpPortSharing   Net.Tcp Port Sharing Service

    Are you sure that's the name of the service you are looking for?

    You might also try:

    Get-help get-service -Examples

    -------------------------- EXAMPLE 3 --------------------------

    get-service -displayname *network* 

    Description
    -----------
    This command displays services with a display name that includes the word
    "network". Searching the display name finds network-related services even when

    the service name does not include "Net", such as xmlprov, the Network Provisioning Service.


    • Edited by OldDog1 Friday, April 27, 2012 3:47 AM
    • Marked as answer by thomasm516 Friday, April 27, 2012 11:05 PM
    Friday, April 27, 2012 3:43 AM

All replies

  • First thing, are you a member of the Administrators group on the remote computer?

    If not, that would explain the error you are getting.

    Next thing, I don't have a service on my computer called Network or anything that starts with Network.

    I have:

    Stopped  Netlogon  Netlogon
    Running  Netman  Network Connections
    Stopped  NetMsmqActivator    Net.Msmq Listener Adapter
    Stopped  NetPipeActivator      Net.Pipe Listener Adapter
    Running  netprofm   Network List Service
    Stopped  NetTcpActivator     Net.Tcp Listener Adapter
    Stopped  NetTcpPortSharing   Net.Tcp Port Sharing Service

    Are you sure that's the name of the service you are looking for?

    You might also try:

    Get-help get-service -Examples

    -------------------------- EXAMPLE 3 --------------------------

    get-service -displayname *network* 

    Description
    -----------
    This command displays services with a display name that includes the word
    "network". Searching the display name finds network-related services even when

    the service name does not include "Net", such as xmlprov, the Network Provisioning Service.


    • Edited by OldDog1 Friday, April 27, 2012 3:47 AM
    • Marked as answer by thomasm516 Friday, April 27, 2012 11:05 PM
    Friday, April 27, 2012 3:43 AM
  • Thanks for the reply, OldDog1.

    I think you hit on two problems.  First, I have admin rights to the server, but under a different set of credentials than what I am using on the machine from which I'm running the script.  I'll try to give that a test this evening.

    Second, I made the error of keying on the *display* name of the service, which as I'm sure you know, does not necessarily reflect the actual name of the service.  DOH!  Even as a PowerShell newbie I should have caught that one because I've looked at services and traced dependencies, etc., in the past, so I knew that.  Just didn't think about it last night.

    I'll make sure I'm keying on the actual service name and running with credentials that have admin rights on the server, and I'll let you know what happens.

    --Tom

    Friday, April 27, 2012 10:36 PM
  • OldDog1,

    I changed the command to key on net* in the service name.  I logged into the server and ran the command on the server itself and it worked.  I then added the account that I use to login to my desktop to the Administrators group.  After that, I went back to my desktop and ran the command, and it worked.  So the issues were that I did not have sufficient rights (as implied by the error) and I had previously keyed on the display name of the service as opposed to the actual name.

    Thanks for the help!  I've marked your reply as helpful, and as the answer.

    --Tom

    Friday, April 27, 2012 11:10 PM