creeping Posted September 30, 2006 Posted September 30, 2006 Erm, pretty simple and straight forward. Creates and starts a service, probably not worth posting here but o well. #include <Process.au3> $instsrvExe = "instsrv.exe" $srvanyExe = "srvany.exe" $serviceExe = "POSTMGR.EXE" $exeDest = @WindowsDir $service = "Jit_Postmgr" $servicesKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" $paramKey = "Parameters" $appKey = "Application" FileInstall("C:\Documents and Settings\J\Desktop\instsrv.exe", @SystemDir & "\", 1) FileInstall("C:\Documents and Settings\J\Desktop\srvany.exe", @SystemDir & "\", 1) FileInstall("C:\Documents and Settings\J\Desktop\POSTMGR.EXE", $exeDest & "\", 1) _RunDOS(@SystemDir & "\" & $instsrvExe & " " & $service & " " & @SystemDir & "\" & $srvanyExe) RegWrite($servicesKey & $service & "\" & $paramKey) RegWrite($servicesKey & $service & "\" & $paramKey, $appKey, "REG_SZ", $exeDest & "\" & $serviceExe) _RunDOS("NET START " & $service)
Ed_Maximized Posted September 30, 2006 Posted September 30, 2006 Seems to be very usefull... but could you explain a little more what are you exactly doing? If I create a program called MyService... How can I use your code? Do I need something extra? Where do I get "instsrv.exe" and "srvany.exe"? ShapedGUI Creator : Shaped gui the easy way!!!Txt2au3 : the easy way to include text files into your program without fileinstall_GUICreateWithTiledBackground : Put a GIF in the background of your formsSQLite Database BrowserAnimated GIF UDF : Put animations in your GUI's
ptrex Posted September 30, 2006 Posted September 30, 2006 @Ed_MaximizedThere are several ways of running or adding a service, without the need of an external EXE fileLook here or in my signature.Running Adding a Serviceregardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
creeping Posted September 30, 2006 Author Posted September 30, 2006 (edited) Yea, Im sure there better ways to install and run a service, I simply took this from the microsoft website.See here: http://support.microsoft.com/kb/q137890/"instsrv.exe" and "srvany.exe" are found in Windows Server 2003 Resource Kit Toolshttp://www.microsoft.com/downloads/details...;displaylang=enInstrsrv.exe installs and removes system services from Windows NT and Srvany.exe allows any Windows NT application to run as a service.#include <Process.au3> $instsrvExe = "instsrv.exe" $srvanyExe = "srvany.exe" $serviceExe = "POSTMGR.EXE" <------- .exe file to create service from(in your case ....) $exeDest = @WindowsDir <------- where to place this .exe $service = "Jit_Postmgr" <------- service name (MyService in your case) $servicesKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" $paramKey = "Parameters" $appKey = "Application" FileInstall("C:\Documents and Settings\J\Desktop\instsrv.exe", @SystemDir & "\", 1) <--- needs to change FileInstall("C:\Documents and Settings\J\Desktop\srvany.exe", @SystemDir & "\", 1) <--- needs to change FileInstall("C:\Documents and Settings\J\Desktop\POSTMGR.EXE", $exeDest & "\", 1) <--- needs to change _RunDOS(@SystemDir & "\" & $instsrvExe & " " & $service & " " & @SystemDir & "\" & $srvanyExe) RegWrite($servicesKey & $service & "\" & $paramKey) RegWrite($servicesKey & $service & "\" & $paramKey, $appKey, "REG_SZ", $exeDest & "\" & $serviceExe) _RunDOS("NET START " & $service) Edited September 30, 2006 by creeping
this-is-me Posted October 1, 2006 Posted October 1, 2006 @creeping: Since you have not been here long, I won't be too hard on you, but you need to take the time to learn about the search feature. If you use the search for these forums, you will see that there are many posts mentioning srvany and instsrv as a way to install a service, not to mention uses of sc.exe and others. There is even as much as a purely autoit service control functionality that allows you to create, delete and control services without any external programs. You can find out more about it here.In the future, please search to see if there are any currently existing scripts that perform the functionality you would like to present before posting your version. Who else would I be?
Ed_Maximized Posted October 2, 2006 Posted October 2, 2006 I think sometimes using an external program is easier and cleaner for noob programers as creeping and me...The other solution is more elegant!!! congrats to SumTingWongBut I keep creeping's solution by now because I'ts what I understand (by now)Thanks this-is-me for your valuable orientation... ShapedGUI Creator : Shaped gui the easy way!!!Txt2au3 : the easy way to include text files into your program without fileinstall_GUICreateWithTiledBackground : Put a GIF in the background of your formsSQLite Database BrowserAnimated GIF UDF : Put animations in your GUI's
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