Sign in to follow this  
Followers 0
TheBG

Check service on remote pc

6 posts in this topic

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.

Share this post


Link to post
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]

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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, 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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by TurionAltec

Share this post


Link to post
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
Sign in to follow this  
Followers 0