I was changing a service from a disabled state to a running state with the startup type as automatic on a bunch of servers, and I was poking around online on how to do it remotely, and using Set-Service for the startup type worked remotely, but for some reason doing a Get-Service | Start-Service gave me an error. I found a site that said you needed to do a Set-Service -Status Running, and that worked, but does that actually start the service? Is there a difference between doing it that way and doing a Start-Service locally?
Here's my final command, because the site also gave me an idea of how to do a 1-liner:
Get-Service -ComputerName SERVER -Name "SERVICE*" | Set-Service -StartupType Automatic -PassThru | Set-Service -Status Running
I like that, but it seemed that services that take a couple seconds to start up with a Start-Service command are immediately set to running with the Set-Service command, meaning that maybe it's not actually starting the service.
I'm sure it's ok, but I'm paranoid and want to make sure.