shital Posted October 17, 2019 Author Share Posted October 17, 2019 Thanks i wasnt aware of it . Can any one please help me for space issue my code still pending . Link to comment Share on other sites More sharing options...
BrewManNH Posted October 17, 2019 Share Posted October 17, 2019 Put quotes around the service name. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
shital Posted October 21, 2019 Author Share Posted October 21, 2019 (edited) $StartService = _RunDos(' net start "CryptSvc" ' ) my service name " XYX Processing service" its nt working above command what mistake in syntax Edited October 21, 2019 by shital Link to comment Share on other sites More sharing options...
shital Posted October 22, 2019 Author Share Posted October 22, 2019 Can anyone help regarding it . I also search these thread still not working Link to comment Share on other sites More sharing options...
AdamUL Posted October 23, 2019 Share Posted October 23, 2019 (edited) You can use the Windows Services UDF to work with services, instead of the command line. A few examples are below. Using the known service name and computer. #RequireAdmin #include <Services.au3> Global $sServiceName = "AppMgmt" Global $sComputer = "shital-PC" ;Check the status of the service, if it is stopped, start it. Global $aService = 0 Do $aService = _Service_QueryStatus($sServiceName, $sComputer) If @error Then Exit 1 If $aService[1] = $SERVICE_STOPPED Then If Not _Service_Start($sServiceName, $sComputer) Then Exit 2 EndIf Sleep(500) ;Wait 500 ms. Until $aService[1] = $SERVICE_RUNNING Using known service display name and computer. #RequireAdmin #include <Array.au3> #include <Services.au3> Global $sComputer = "shital-PC" ;Get a list of all services. Global $aServices = _Service_Enum($SERVICE_WIN32, $SERVICE_STATE_ALL, Default, $sComputer) If @error Then Exit 1 ;Search for the service display name. Global $sSearch = "XYX Processing service" Global $aFound = _ArrayFindAll($aServices, $sSearch, 1, 0, 0, 1, 1) ;Starting with row 1, partial search, 2D array column 1. If @error Then Exit 1 + @error ;If more than one service is found, exit. If UBound($aFound) > 1 Then Exit 8 ;Get service name from found service display name. Global $sServiceName = $aServices[$aFound[0]][0] ;Check the status of the service, if it is stopped, start it. Global $aService = 0 Do $aService = _Service_QueryStatus($sServiceName, $sComputer) If @error Then Exit 9 If $aService[1] = $SERVICE_STOPPED Then If Not _Service_Start($sServiceName, $sComputer) Then Exit 10 EndIf Sleep(500) ;Wait 500 ms. Until $aService[1] = $SERVICE_RUNNING Adam Edited October 23, 2019 by AdamUL Link to comment Share on other sites More sharing options...
shital Posted November 11, 2019 Author Share Posted November 11, 2019 _Service_QueryStatus undefine im getting issue Link to comment Share on other sites More sharing options...
AdamUL Posted November 11, 2019 Share Posted November 11, 2019 That's not enough detail to go on. What are you getting from _Service_QueryStatus? _Service_QueryStatus returns an array. Adam Link to comment Share on other sites More sharing options...
shital Posted November 11, 2019 Author Share Posted November 11, 2019 (edited) I guess im not getting your code.for running first code it showing #include <Services.au3> undefine . if possible can u plz describe Services.au3 not library then which file is Services.au3 Edited November 11, 2019 by shital Link to comment Share on other sites More sharing options...
AdamUL Posted November 11, 2019 Share Posted November 11, 2019 You need to download the services UDF from the link in my post above, above the code I posted. Adam Link to comment Share on other sites More sharing options...
shital Posted November 11, 2019 Author Share Posted November 11, 2019 Thanks found code One more things it open window poup and ask for allow autoit program tp run .is that anyway to suppress it ? Link to comment Share on other sites More sharing options...
AdamUL Posted November 11, 2019 Share Posted November 11, 2019 This is due to the #RequireAdmin directive causing a UAC prompt. How do you plan to deploy the script? This determines how, and if you need to suppress the prompt. Adam Link to comment Share on other sites More sharing options...
shital Posted November 13, 2019 Author Share Posted November 13, 2019 Actually , #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_type=a3x #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Services.au3> Global $sServiceName = "Intell Processing Service" Global $sComputer = "el66" ;Check the status of the service, if it is stopped, start it. Global $aService = 0 Do $aService = _Service_QueryStatus($sServiceName, $sComputer) If @error Then Exit 1 If $aService[1] = $SERVICE_STOPPED Then If Not _Service_Start($sServiceName, $sComputer) Then Exit 2 EndIf Sleep(500) ;Wait 500 ms. Until $aService[1] = $SERVICE_RUNNING These code not working due to service name space . That same issue it wasn't solved yet and other code run exe but my services not start with exe it work with sc or net start .My point is i want check service running or not after some interval and if its not work again service should start on remote pc . Link to comment Share on other sites More sharing options...
BrewManNH Posted November 13, 2019 Share Posted November 13, 2019 Try this for the spaces in the name issue. Global $sServiceName = '"Intell Processing Service"' I added quotes around the service name. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
AdamUL Posted November 13, 2019 Share Posted November 13, 2019 Are you sure that is the service name, and not the service display name? The UDF needs the service name to work. This script searches for the service name based on its display name. I posted this above, but I'll include it here with the update information you gave. You need admin rights on the remote PC for it to work. #RequireAdmin #include <Array.au3> #include <Services.au3> Global $sComputer = "el66" ;Get a list of all services. Global $aServices = _Service_Enum($SERVICE_WIN32, $SERVICE_STATE_ALL, Default, $sComputer) If @error Then Exit 1 ;Search for the service display name using partial name. Global $sSearch = "Intell Processing" Global $aFound = _ArrayFindAll($aServices, $sSearch, 1, 0, 0, 1, 1) ;Starting with row 1, partial search, 2D array column 1. If @error Then Exit 1 + @error ;If more than one service is found, exit. If UBound($aFound) > 1 Then Exit 8 ;Get service name from found service display name. Global $sServiceName = $aServices[$aFound[0]][0] ;Check the status of the service, if it is stopped, start it. Global $aService = 0 Do $aService = _Service_QueryStatus($sServiceName, $sComputer) If @error Then Exit 9 If $aService[1] = $SERVICE_STOPPED Then If Not _Service_Start($sServiceName, $sComputer) Then Exit 10 EndIf Sleep(100) ;Wait 100 ms. Until $aService[1] = $SERVICE_RUNNING Or you can check the service name with the service.msc and it properties. Example below. The service name is highlighted. Adam Link to comment Share on other sites More sharing options...
shital Posted November 19, 2019 Author Share Posted November 19, 2019 Yes Service name have space im sure about it Link to comment Share on other sites More sharing options...
shital Posted November 20, 2019 Author Share Posted November 20, 2019 our product service name have space . Can anyone help me regarding space service name i have tried all way for space still service nt get start. Link to comment Share on other sites More sharing options...
Earthshine Posted November 20, 2019 Share Posted November 20, 2019 (edited) something like $result = RunWait(@ComSpec & ' /c net start server', $varPath & '\YourServiceExename.exe', @SW_HIDE) or use the built in windows SC command, it's super easy. SC Start "Your Service Name here" https://commandwindows.com/sc.htm Edited November 20, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
shital Posted November 21, 2019 Author Share Posted November 21, 2019 my product not start with exe and sc service name i tried that why i switch to run .any other solution plz . Link to comment Share on other sites More sharing options...
Earthshine Posted November 21, 2019 Share Posted November 21, 2019 if it doesn't start by either of those methods then it plain doesn't work. solution is to fix your service. seadoggie01 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
shital Posted November 27, 2019 Author Share Posted November 27, 2019 (edited) Its not feasible to change service name .if possible plz give me another way ..i want run that script on scheduler and that task pending from long . Global $sServiceName = '"Intell Processing Service"' these also not working not Edited November 27, 2019 by shital 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