GEOSoft Posted April 16, 2008 Author Share Posted April 16, 2008 $Computer = "COMPUTERNAME" $Domain = "DOMAIN" $User = InputBox("User Name", "Please enter your user name:") $Password = InputBox("Password", "Please enter your password:", "", "*") $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, _ "root\cimv2", _ $User, _ $Password, _ "MS_409", _ "ntlmdomain:" + $Domain) $colSwbemObjectSet = _ $objSWbemServices.ExecQuery("Select * From Win32_Process") For $objProcess In $colSWbemObjectSet MsgBox(0, "Output", "Process Name: " & $objProcess.Name) Next .. am getting; c:\Scripts\services.au3 (18) : ==> The requested action with this object has failed.: $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" + $Domain) $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" + $Domain)^ ERROR I obviously change the $Computer and $Domain.Close doesn't always work. Try this $Computer = "COMPUTERNAME" $Domain = "DOMAIN" $User = InputBox("User Name", "Please enter your user name:") $Password = InputBox("Password", "Please enter your password:", "", "*") $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, _ "root\cimv2", _ $User, _ $Password, _ "MS_409", _ "ntlmdomain:" & $Domain) $colSwbemObjectSet = _ $objSWbemServices.ExecQuery("Select * From Win32_Process") For $objProcess In $colSWbemObjectSet MsgBox(0, "Output", "Process Name: " & $objProcess.Name) Next George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ale1981 Posted April 17, 2008 Share Posted April 17, 2008 still not working... Scripts\services.au3 (18) : ==> The requested action with this object has failed.: $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & $Domain) $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & $Domain)^ ERROR I have made sure the username password is correct. Link to comment Share on other sites More sharing options...
GEOSoft Posted April 17, 2008 Author Share Posted April 17, 2008 still not working... Scripts\services.au3 (18) : ==> The requested action with this object has failed.: $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & $Domain) $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & $Domain)^ ERROR I have made sure the username password is correct.Try changing $Domain = "DOMAIN" To $Domain = '"DOMAIN"' OR change $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & $Domain) To $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & Chr(34) & $Domain & Chr(34))^ George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ale1981 Posted April 18, 2008 Share Posted April 18, 2008 (edited) Still nothing.. this really doesnt want to work!! Scripts\services.au3 (18) : ==> The requested action with this object has failed.: $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & chr(34) & $Domain & Chr(34)) $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & chr(34) & $Domain & Chr(34))^ ERROR Edited April 18, 2008 by ale1981 Link to comment Share on other sites More sharing options...
GEOSoft Posted April 18, 2008 Author Share Posted April 18, 2008 Still nothing.. this really doesnt want to work!! Scripts\services.au3 (18) : ==> The requested action with this object has failed.: $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & chr(34) & $Domain & Chr(34)) $objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" & chr(34) & $Domain & Chr(34))^ ERRORPM me the script and I'll take a look at it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
engine Posted May 6, 2008 Share Posted May 6, 2008 It would be nice to have these UDF included with AutoIt. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
GEOSoft Posted May 15, 2008 Author Share Posted May 15, 2008 I've done some major updates with this UDF. It now includes most of the code and modifications posted in the thread. I also removed the code from the first post. Please use the link instead. For the download you can either use the link in the post or click on Download at the bottom of the web page. Thanks to all who suggested modifications and provided additional code. If there is something on the page that you did not get credit for then let me know and I'll change it. If you have more functions to add then please PM them to me for inclusion. Enjoy George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted May 15, 2008 Author Share Posted May 15, 2008 It would be nice to have these UDF included with AutoIt.I have not submitted it for inclusion and it may never be submitted.There is more testing/debugging to be done before that would be considered. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
faire Posted May 17, 2008 Share Posted May 17, 2008 How can I set the Description text of a service? Link to comment Share on other sites More sharing options...
GEOSoft Posted May 17, 2008 Author Share Posted May 17, 2008 (edited) ; #include <services.au3> Global $sDesc, $serv = "Spooler" $Details = _Service_GetDetails("$serv") If IsArray($Details) Then $sDesc = $Details[10] MsgBox(0, "Result", $serv & @CRLF & @CRLF $sDesc) Else MsgBox(0, "Ooooops", $serv & " does not exist.") EndIf ; EDIT: Make sure you have the latest version of services.au3 Edited May 17, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
faire Posted May 17, 2008 Share Posted May 17, 2008 (edited) I think you misinterpreted my question. I have found a workaround though: you can make a registry key called "Description" and import it to the registry entry of your service. Not pretty, but works. Edited May 17, 2008 by faire Link to comment Share on other sites More sharing options...
GEOSoft Posted May 17, 2008 Author Share Posted May 17, 2008 I think you misinterpreted my question. I have found a workaround though: you can make a registry key called "Description" and import it to the registry entry of your service. Not pretty, but works.You are correct. I totally missed the SET. I can write a function to do that, but not today. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
archai2 Posted May 17, 2008 Share Posted May 17, 2008 How can I set the Description text of a service? CODE$sComputer = "." $sServiceName = "< MY SERVICE >" $sDescription = "My Service Description" RunWait(@ComSpec & ' /C sc \\' & $sComputer & ' description ' & $sServiceName & ' "' & $sDescription & '"', "", @SW_HIDE) Link to comment Share on other sites More sharing options...
faire Posted May 17, 2008 Share Posted May 17, 2008 (edited) Hmm.. this is odd! My service gets terminated after 30 seconds with the error: "Error 1053: The service did not respond to the start or control request in a timely fashion". It runs fine for those 30 seconds though, it's just that Windows terminates it because it "doesn't respond to the start or control request".Do I need to add some special code to my script for it to be properly run as a service?To further the explanation, let's take this rather silly code:While 1 Sleep(20) $Pid = WinGetProcess("Untitled - Notepad") ProcessClose($Pid) WEndSurely this doesn't contain anything which should stop it from running as a service Edit: found this: "NOTE: To verify that the service was created correctly, check the registry to verify that the ImagePath value underHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\service nameis set to point to SRVANY.EXE. If this is not set correctly, the service will stop shortly after it starts and return an Event ID 7000 "The service name failed to start." So you DO still need SRVANY.EXE for this to work? Edit2: I've taken the approach outlined in post #23. The service being started acts as a launcher for the real program. The only drawback is that it still leaves a nasty error in the Eventlog (two, actually: 7000 and 7009), but that's ok... Edited May 17, 2008 by faire Link to comment Share on other sites More sharing options...
engine Posted May 24, 2008 Share Posted May 24, 2008 (edited) Hi. I was using the latest version of the script and I got this error while using the function Service_Delete() I am using AutoIt 3.2.12.0 Kind regards. Edited May 24, 2008 by engine My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
GEOSoft Posted May 24, 2008 Author Share Posted May 24, 2008 (edited) Hi. I was using the latest version of the script and I got this error while using the function Service_Delete() Thanks. It's getting a bit late here right now but I'll look at it in the morning. Edit: Did you check to make sure the service exists befor trying to delete it? Edited May 24, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted May 24, 2008 Author Share Posted May 24, 2008 (edited) Beta version sent to you by PM EDIT: Apparently it worked for you so the file has been updated on the site. Edited May 25, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
engine Posted May 25, 2008 Share Posted May 25, 2008 Beta version sent to you by PMEDIT:Apparently it worked for you so the file has been updated on the site.The file you download from the site is still the old one. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
GEOSoft Posted May 25, 2008 Author Share Posted May 25, 2008 (edited) The file you download from the site is still the old one.Thanks. I'll try it again.EDIT: I must have forgotten to upload the zip when I uploaded the au3 file. It's okay now. Edited May 25, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
engine Posted May 25, 2008 Share Posted May 25, 2008 Thanks. I'll try it again.EDIT: I must have forgotten to upload the zip when I uploaded the au3 file. It's okay now.It's there now. Thanks.Question:Do you need ProcessWaitClose($sServiceName) after _Service_Delete()? My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] 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