Jump to content

Check service on remote pc


TheBG
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 :D 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]

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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, state

This 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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by TurionAltec
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...