Sign in to follow this  
Followers 0
midiaxe

Start/Stop a Service

12 posts in this topic

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=

Share this post


Link to post
Share on other sites



Hi,

is indeed not a default function.

Perhaps post an message in the Idea section ?

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

It is a good idea. But I would even greater if it they'll also non standard commands like "Disable Sevice", or if possible even "Uninstall Service".

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

a friend of mine uses vbscripting to stop, verify, start, verify services. you could probable write a vbscript and then launch it with a runwait from autoit. Apparently vbscript will work on 2000, XP, 2003, and NT if scripting patch is installed.


Share this post


Link to post
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
Sign in to follow this  
Followers 0