Get-Service error

Loran Calvin 61 Reputation points
2021-01-19T19:11:24.087+00:00

Background info:

I have several computers. Some have Windows 10 Home, Windows 10 Pro, and one with Windows 7 Ultimate.
Network is Homegroup. I'm learning Powershell ISE 5.1, signed on as an Administrator.

The problem is when I run : Get-Service without any parameters it runs fine because it's the local computer. But if I run it with the -ComputerName parameter and the name of one of the other computers on the network, for example:

Get-Service -ComputerName Lenovo17

I get, the following error:

Get-Service : Cannot open Service Control Manager on computer 'Lenovo17'.
This operation might require other privileges.
At line:1 char:1

  • Get-Service -ComputerName Lenovo17
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Get-Service], InvalidOperationException
  • FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetServiceComm
    and

What do I need to do to get this command to run properly without error?

Loran Calvin

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,406 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 45,111 Reputation points
    2021-01-20T03:03:59.19+00:00

    Not really a PowerShell thing. It's Windows thing.

    To enumerate services, your process needs the SC_MANAGER_ENUMERATE_SERVICE right. Interactive users have it, but if your doing this from another machine you're not an interactive user. Make the account a member of a group that has that right.

    0 comments No comments

  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 31,091 Reputation points Microsoft Vendor
    2021-01-20T04:47:32.617+00:00

    Hi,

    This could be helpful
    Remote Get-Service as Normal user require other privileges

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments