• Great article! I've been working at learning PowerShell for a little while now and look forward to future articles.

    I can manually stop the agent on my test server myself and when I run the script it will tell me that it is stopped but the script won't start it. I get this error:

    Start-Service : Cannot find any service with service name 'SQLSERVERAGENT'.

    At line:12 char:14

    + Start-Service <<<<

    + CategoryInfo : ObjectNotFound: (SQLSERVERAGENT:String) [Start-Service], ServiceCommandException

    + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StartServiceCommand

    What am I missing?