2

I am trying to run this in PowerShell7

PS C:\Users\MYUSER> $myoutput = get-service| where-Object Status -eq "Stopped"| select-Object Name, Status

However, I am getting the below error:

Get-Service: Service 'McpManagementService (McpManagementService)' cannot be queried due to the following error:

How can I work around it?

Javi Torre
  • 724
  • 8
  • 23

2 Answers2

0

Looks like powershell is not able to pull the data for one or more services. Hence, this error message. if you extract the data from $myoutput variable, you should see the output for rest of the services.

jim
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – xlmaster Feb 24 '23 at 12:32
0

I think problem described there:

PowerShell GitHub Issues

Solution (not the best) Just ignore an error something like:

Get-Service -ErrorAction SilentlyContinue
pryabov
  • 702
  • 2
  • 7
  • 23