Task to Stop SQL Instances

(imported topic written by SystemAdmin)

I’m looking to create a task that will stop all SQL instance services. I know this is not correct, but here is the action script I have come up with so far. Help would be greatly appreciated…

delete __appendfile

appendfile @echo off

appendfile echo Your administrator is stopping All SQL Instances…

appendfile net stop {concatenation of (service name of it & " & net stop ") of services whose (exists file (first match (case insensitive regex "

^%22

*sqlservr.exe") of (image path of it)))}

delete sqlStop.bat

copy __appendfile sqlStop.bat

run sqlStop.bat

Andrew

(imported comment written by SystemAdmin)

Help?

(imported comment written by SystemAdmin)

Anyone wondering, I think I figured it out:

delete __appendfile

appendfile @echo off

appendfile {concatenation “%0a%0d” of ("net stop " & service name of it) of services whose (exists file (first match (case insensitive regex "[

^%22]

*sqlservr.exe") of (image path of it)))}

delete sqlStop.bat

copy __appendfile sqlStop.bat

run sqlStop.bat