When I tried to splat in v7 I keep getting the error: Get-Service: A parameter cannot be found that matches parameter name 'ComputerName'.
However when I looked at the solution it looked exactly like that, then I tested in v5.1 and worked.
Have you checked the docs for the 5.1 version and the 7.x version of the Get-Service?
The answer is there. Take a look, see if you can see it. Let us know what you find.
Here is a hint, while 7.x has its roots in 5.1, 7.x is not simply the “next version”. They are two different versions of PS. Which means they will not function the same. There are differences in parameters.
Thanks for the reply, checking the documentation for both versions is definitely something I missed.
Looking at it now I can see the difference.
While v5.1 has the parameter -ComputerName, v7 does not and that’s why it failed, it can not recognize such parameter.
Also I see another difference is that v7 is meant to work on a computer, so if you need to query multiple ones I think you’d need to use Invoke-Method instead of a parameter name.