@Pete-S said in Inconsistent output from PS script:
@gjacobse said in Inconsistent output from PS script:
@Pete-S said in Inconsistent output from PS script:
@gjacobse said in Inconsistent output from PS script:
@Pete-S said in Inconsistent output from PS script:
@Pete-S said in Inconsistent output from PS script:
@gjacobse said in Inconsistent output from PS script:
Get-Service -ComputerName pc1, pc2 SERVICE | Select name, MachineName, StatusWhere did you get the -ComputerName syntax from?
I can't find anything like that from the manual: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-service?view=powershell-7.2
OK, it's been deprecated. It's available in older versions of powershell, up to 5.1.
I read somewhere it doesn't use powershell remoting but dcom instead. And that's why it became obsolete.
Maybe you haven't got the right dcom privileges to run it remotely.
Say what now? I'm reading this:
https://learn.microsoft.com/en-us/powershell/scripting/samples/managing-services?view=powershell-7.2
I'd put one script on each remote computer and have it send an email whenever the service stops. Or check whatever it is you really want to know with the service.
Sadly, we already monitor the service. I can be 'running' but fail and need to be stop/started. We've also already done the scheduled task route where it checked it ever 15 min and stop/started it. But there are still times it needs to be manually stop/started. And this is 10x better then what they were doing when I started last year....
OK, so the script is part of something you actually use to restart it when you decide to?
Yes - while I would like to solve it with PS,.. my batch script works fine. I just figured with all that I am / have been doing with PS,.. why not convert it to PS and go one.
Now - if there is another way to accomplish this - I'm open to learning. It's what I'm applying with PS - learning.