Jump to content

Start/Stop a Service


midiaxe
 Share

Recommended Posts

Hello everybody,

I have an installation where I need to stop an existing service before the installation and restart after. I looked at the AI doc and didn't find anything about starting/stopping a service. I guess it's not available yet in the current version ( I hope I'm wrong). I can use "net start <service>" and "net stop <service>" but would like to use an autoit function.

Thanks,

=MX=

Link to comment
Share on other sites

To Ezzetabi,

to Disable service see :

RegWrite("HKLM\System\CurrentControlSet\Services\{servicename}\Start".........

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

If you know you'll only be using WinXP ONLY, try the SC command (Service Controller). Use Windows Help (gasp!) and type A-Z in the search bar, and click on "Command-line reference A-Z" and then on the letter S at the top of the window. SC will be at the top of the list - click on it for the full reference.

Jerry

Link to comment
Share on other sites

If you know you'll only be using WinXP ONLY, try the SC command (Service Controller).  Use Windows Help (gasp!) and type A-Z in the search bar, and click on "Command-line reference A-Z" and then on the letter S at the top of the window.  SC will be at the top of the list - click on it for the full reference.

Jerry

<{POST_SNAPBACK}>

If you want to remove service see these keys :

regdelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentControlSet\Services\xxxxxxxxx")

regdelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentControlSet\Enum\Root\xxxxxxxxxxxxx")

where the x are service name.

To stop the service :

RunWait(@ComSpec & " /c " & 'net stop <service>', "", @SW_HIDE) works fine.

chees

Edited by kristoff
Link to comment
Share on other sites

If you want to remove service see these keys :

regdelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentControlSet\Services\xxxxxxxxx")

regdelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentControlSet\Enum\Root\xxxxxxxxxxxxx")

Er, maybe you mean:

"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

  • 1 month later...

Larry,

Could you expound upon your comment of trapping the return code when using the "Net Stop" command to stop a service. As an example, stopping and then restarting the "Spooler" service. Obviously there should not be an attempt to restart the service until it has completed a stop. I would be interested in seeing an example of AutoIT using the return code to test a 'Pass' / 'Fail' type of scenario.

Thanks,

ZK

Link to comment
Share on other sites

If you know you'll only be using WinXP ONLY, try the SC command (Service Controller).  Use Windows Help (gasp!) and type A-Z in the search bar, and click on "Command-line reference A-Z" and then on the letter S at the top of the window.  SC will be at the top of the list - click on it for the full reference.

Jerry

<{POST_SNAPBACK}>

or, if you're not just using XP, try using SysInternals' PsService

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...