beato Posted November 3, 2011 Posted November 3, 2011 (edited) I have been trying to convert a process I use from a .bat into autoit using the Comspec call but cannot seem to get this to work. I have searched and tried numerous methods to no avail. The .bat creates and registers a service (with domain credentials) and works every time - I'm just trying to streamline this into a EXE. I have tried two of the Service UDF's (Services.au3 + ServiceControl.au3) to no avail, nadda. I don't know if Comspec is the best method but I'm trying to emulate it since the "bat" method works. For the "bat" method I'm using the Windows "SC.EXE" app to register/configure. Works flawlessly on both XP and WIn7 x64 clients. We use Win7 x64 for all but a few XP wkst so it needs to run on both. Basically this util will run on all clients via a log in script => I'm reconfiguring the current service to run locally rather than on the network, so I'm deleting it and re-registering it - I know you can re-configure an existing service but that doesn't work either. Also part of the configuration is that it needs to set "auotmatic startup / domain acct with its password". Current bat: "K:\application\folder1\sc" config Myservice obj= "domain\admin" password= test >>service.log "K:\application\folder1\sc" config Myservice start= auto >>service.log NET start Myservice >>service.log One of server Service udf commands I have tried: $sServiceName = "MyService" _StopService("", $sServiceName) ;~ deletes service $servicename = "MyService" _DeleteService("", $servicename) ;~ Setting local service $servicename = "MyService" $sDisplayName = "MyService" $sBinaryPath = "C:\Program Files (x86)\Application\bin\MyService.exe" $sServiceUser = "domain\admin" $sPassword = "password" ;~ Creating local service _CreateService("", $servicename, $sDisplayName, $sBinaryPath, $sServiceUser, $sPassword) sleep(2000) ;~ starts servcice $sServiceName = "Myservice" _StartService("", $sServiceName) Edited November 3, 2011 by beato
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now