DemonAngel Posted January 22, 2006 Share Posted January 22, 2006 I created a script that I use as a syslog server. It receives all the syslog messages directed to my PC and then writes them to a access database. I was wondering if there is a way to change my script so that it would run as a local service? Link to comment Share on other sites More sharing options...
MHz Posted January 22, 2006 Share Posted January 22, 2006 To run a compiled AutoIt script as a service, you can use Instsrv.exe and Srvany.exe from Microsoft. A UDF below may help to setup the service. Have Instsrv.exe and Srvany.exe in System32 directory. Func _SrvAny($service, $fullpath, $hidden = 0) ; Adds a program, as a windows service. ; Requires $instsrv and $srvany to be assigned, full paths. ; e.g. _SrvAny ( 'ServiceName', 'FullPath_to_the_program' ) Local $instsrv = @WindowsDir & '\System32\Instsrv.exe' Local $srvany = @WindowsDir & '\System32\SrvAny.exe' If FileExists($instsrv) And FileExists($srvany) Then RunWait($instsrv & ' ' & $service & ' "' & $srvany & '"', '', @SW_HIDE) Local $key = 'HKLM\SYSTEM\CurrentControlSet\Services\' & $service If RegRead($key, 'DisplayName') Then If $hidden Then RegWrite($key & '\Parameters', 'AppParameters', 'Reg_sz', '/hidden') Return RegWrite($key & '\Parameters', 'Application', 'Reg_sz', $fullpath) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
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