PC Review
Forums
Newsgroups
Windows XP
Windows XP WMI
Services
Forums
Newsgroups
Windows XP
Windows XP WMI
Services
![]() |
Services |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I created a script that changes a services startup type to manual, then
starts it and runs a command that uses that service. What I need to do now is stop the service and set it back to disabled. When I specify to do this later in the script it stops the service to quick, and doesn't set it to disable. How can I do this while allowing the command time to run? Thanks for any help and information. -- Infotech |
|
|
|
#2 |
|
Guest
Posts: n/a
|
You should intercept your process startup and stop events, possibly using
the Win32_ProcessStartTrace and Win32_ProcessStopTrace events to trigger your service disable or stop routine. select * from win32_processStopTrace where processName = "calc.exe" Would fire an event to the client any time a process named calc.exe closed. If working with OS's prior to WinXP you can also detect this state with a slightly different EventNotificationQuery: select * from __instanceDeletionEvent within 5 where targetInstance isa "win32_process" and targetInstance.caption = "calc.exe" -- [MS] Scott McNairy WMI Test Engineer This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm "Infotech" <df> wrote in message news:%23S$Yl%23RXEHA.1656@TK2MSFTNGP09.phx.gbl... > I created a script that changes a services startup type to manual, then > starts it and runs a command that uses that service. What I need to do now > is stop the service and set it back to disabled. When I specify to do this > later in the script it stops the service to quick, and doesn't set it to > disable. How can I do this while allowing the command time to run? > > Thanks for any help and information. > > -- > Infotech > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Infotech wrote:
> I created a script that changes a services startup type to manual, then > starts it and runs a command that uses that service. What I need to do now > is stop the service and set it back to disabled. When I specify to do this > later in the script it stops the service to quick, and doesn't set it to > disable. How can I do this while allowing the command time to run? Hi After initializing the stop command, you can go into a loop and wait for the status to be "stopped" before you continue, here is an example: http://groups.google.com/groups?sel...2C2%40hydro.com -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/co...er/default.mspx |
|
|
|
#4 |
|
Junior Member
|
Please, any know some sample working using Win32_ProcessStartTrace??
I have proyect VB.Net using Form, Thank you. |
|
|
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

