Get-Service -ComputerName not supported anymore?
Get-Service used to support a ComputerName parameter so that I can connect to a remote server and get the services from there. Is it no longer supported in PS7? I saw a suggestion to run the script remotely on each server where you want to get the services from, which is highly impractical and slow too.

1 comment
-
Jesse Silverman commented
I'm just getting back into PowerShell again for real after some time away, but the approach of adding a separate functionality for -ComputerName for each different command individually was abandoned long ago. Even in 5.1, which I still use sometimes, the "new" way of calling Invoke-Command works just great -- better and more efficiently than calling the Get-Service, Get-Process, etc. etc. commands with the -ComputerName parameter.
It is a breaking change if you have the commands hard-coded with -ComputerName, i.e. you will need to update your scripts, but from everything I've read it is better to do it with PowerShell remoting and the Invoke-Command -- for one thing, Invoke-Command calls them in parallel, which the built-in -ComputerName in Get-Service, Get-Process etc. did not. There are a few other differences besides that in terms of exactly how the output comes back, but this is squarely the new way going forward, I believe.