Hi All.
I am trying to run a powershell script which stops a service via SQL Agent, at the moment the scripts says that it completes however the service isnt being stopped, I know SQL 2008 R2 only has the powershell mini version or so. I am just thinking of a way to do this without invoking xp_cmdshell.
if (Get-Service "Service" -ErrorAction SilentlyContinue) { get-service MsMpSvc | where {$_.status -eq 'running'} | stop-service -pass }
I have also tried to save this onto a powershell file and then use CMDExec to try to run it, that hasnt worked either.
Any ideas ?