![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Script to stop a service I am trying stop the service SQL Server VSS Writer using the following as taken and modified from Microsoft website. The script appears to run without errors but the service does not stop, any ideas on what I need to add or modify to get it working. ' Start of Script strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root \cimv2") Set colServiceList = objWMIService.ExecQuery("Associators of " _ & "{Win32_Service.Name='NetDDE'} Where " _ & "AssocClass=Win32_DependentService " & "Role=Antecedent" ) For Each objService in colServiceList objService.StopService() Next Wscript.Sleep 20000 Set colServiceList = objWMIService.ExecQuery _ ("Select * from Win32_Service where Name='SQL Server VSS Writer'") For Each objService in colServiceList errReturn = objService.StopService() Next 'end of script |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Script to stop a service "Cat" <cathossie@newsgroup> wrote in message news:e4fa2257-91af-48cb-ab32-6ff955e12875@newsgroup Quote: >I am trying stop the service SQL Server VSS Writer using the following > as taken and modified from Microsoft website. The script appears to > run without errors but the service does not stop, any ideas on what I > need to add or modify to get it working. > > ' Start of Script > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" & strComputer & "\root > \cimv2") > > Set colServiceList = objWMIService.ExecQuery("Associators of " _ > & "{Win32_Service.Name='NetDDE'} Where " _ > & "AssocClass=Win32_DependentService " & "Role=Antecedent" ) > > For Each objService in colServiceList > objService.StopService() > Next > > Wscript.Sleep 20000 > > Set colServiceList = objWMIService.ExecQuery _ > ("Select * from Win32_Service where Name='SQL Server VSS > Writer'") > For Each objService in colServiceList > errReturn = objService.StopService() > Next > 'end of script Prompt like so: net stop netdde net stop "SQL Server VSS" |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
Help Stop running this script Msg | Network & Sharing | |||
| how to stop confirmation in script | PowerShell | |||
| how to stop service on vista | General Discussion | |||
| How is it possible to execute start-service and stop-service through a Web-interface? | PowerShell | |||
| which service can stop at VISTA? | Vista General | |||