TheBG Posted September 16, 2009 Posted September 16, 2009 anyone know of an easy to way to check a specific service on a remote pc? I'm wanting to create a small app that with query a defined service on a network pc. Would need to know if it's running or not, and then have a ability to start-stop-restart the service.
Mecrazycoder Posted September 17, 2009 Posted September 17, 2009 anyone know of an easy to way to check a specific service on a remote pc?I'm wanting to create a small app that with query a defined service on a network pc. Would need to know if it's running or not, and then have a ability to start-stop-restart the service.I am thinking this can be done by TCP. First establish a TCP connection to remote system and then start/stop the services. [size="4"][font="Arial Narrow"][font="Garamond"]Attitude is a little thing that makes a big difference[/font][/font][/size][indent][/indent]
jvanegmond Posted September 17, 2009 Posted September 17, 2009 TheBG, some more information for you. There's no need to write a fully custom implementation like Mecrazycoder suggested, many of this stuff has already been built. (You didn't think you were the first that needed to control remote services, right?). http://www.autoitscript.com/forum/index.php?showtopic=91800 http://www.sysinternals.com/Utilities/PsTools.html http://www.autoitscript.com/forum/index.php?showtopic=22165 http://www.autoitscript.com/forum/index.php?showtopic=16854 (In order of importance) github.com/jvanegmond
water Posted September 17, 2009 Posted September 17, 2009 (edited) You could use WMI.The examle using the command line version of WMI lists all services with startmode and state on a remote pc.Wmic /node:<Name of PC> or <IP> /user:<Userid> /password:<password> service get caption, name, startmode, stateThis post uses WMI to check the services on the local machine but it shouldn't be like brain surgery to extend it.Or look here or search the forum archive. Edited September 17, 2009 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
TheBG Posted September 22, 2009 Author Posted September 22, 2009 Thanks for all the suggestions: I have a semi working app now. Just having issues with checking status on certain services. I'm using the ServiceControl.au3. But I'm getting false positives when checking certain services. I'm guess it's because the service does not respond to SERVICE_CONTROL_INTERROGATE commands that is used by ServiceControl.au3
TurionAltec Posted September 22, 2009 Posted September 22, 2009 (edited) Built in Windows tools NET and SC of any use? net use \\192.168.0.2 Password /user:admin sc \\192.168.0.2 query themes sc \\192.168.0.2 start themes sc \\192.168.0.2 config themes start= demand sc \\192.168.0.2 query themes I'd only like to caution that if you use SC, somewhere there exists a program that is also sc.exe, and the installer will put that program's subdir in the path BEFORE system32, which will cause sc to throw errors, so specify %systemroot%\system32\sc.exe Also, I can't get tasklist to work correctly on a remote machine, however pslist (from sysinternals) seems to work fine. If the service has a specific name, you can use that to see if it's running: pslist \\192.168.0.2 -u admin -p Password explorer Edited September 22, 2009 by TurionAltec
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