Hi Chris,
I think we can use the WMI to do the stuff.
In the .net framework we can use the classes under the system.management
namespace which is a .net wrap of wmi.
Here is code going.
Imports System.Management
Module Module1
Sub Main()
'replace the computername according to your senario.
Dim mc As New
System.Management.ManagementClass("\\computername\ root\cimv2",
"Win32_Service", New ObjectGetOptions)
For Each o As ManagementObject In mc.GetInstances()
Console.WriteLine(o.GetPropertyValue("Name"))
Console.WriteLine(o.GetPropertyValue("State"))
Next
End Sub
End Module
Here is the properties we can get in the Win32_Service.
Win32_Service
http://msdn.microsoft.com/library/de...us/wmisdk/wmi/
win32_service.asp
You may also take a look at the link below.
Take Charge with Windows Management Instrumentation
http://msdn.microsoft.com/library/de...us/dnasdj00/ht
ml/asp00a1.asp
Monitoring and Dynamically Configuring Windows Services
http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/config_winservices.asp
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Check Windows Services are still running OK
thread-index: AcRDtC5H2rH66otISW+HC9NT4NoJ2g==
X-WN-Post: microsoft.public.dotnet.languages.vb
From: "=?Utf-8?B?Q2hyaXMgUG9kbW9yZQ==?=" <ch****@newsgroups.nospam>
Subject: Check Windows Services are still running OK
Date: Wed, 26 May 2004 23:31:02 -0700
Lines: 8
Message-ID: <B9**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.languages.vb
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.vb:205795
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
I don't know if this is the correct newsgroup but I couldn't find one for
Windows Services.
Is it possible to check that a Windows Service is still running from
another machine?
The idea being a couple of machines will be running my Windows Services to
handle certain parts of our application, these machines will be located in
the server room. I would like to create an application that runs on one of
the users PC's that checks that these services are still running and
haven't had any errors. Is it possible?
Thanks in advance.
Chris Podmore.