• Thanks DJ. Can you maybe explain the purpose of the Set-ExecutionPolicy command? Also, when I tried the sample code, I got an error when trying to restart a server which I manually stopped:

    Start-Service : Service 'SQL Server Agent (SQL2008) (SQLAgent$SQL2008)' cannot be started due to the following error: Cannot open SQLAgent$SQL2

    008 service on computer '.'.

    At line:6 char:14

    + Start-Service <<<<

    + CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service], ServiceCommandException

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