I don't do a lot of Powershell programming myself, but my company uses it quite a lot for automation. We have several WCF web services that need to be running to support our web site, and it is a pain tracking them down and starting/stopping them in my local development environment. I found a few handy commands for doing this in Powershell, and wanted to capture them so that I can easily find them again if necessary.
The following command gets a list of services, and starts any of them that are currently stopped.
get-service <comma-separated list of services> | where {$_.status -eq 'stopped'} | start-service -pass
The following command does the opposite; it stops any of the services that are currently running.
get-service <comma-separated list of services> | where {$_.status -eq 'running'} | stop-service -pass