support

download helpfile

FAQ and samples

download a patch

 

     

  ntXdll FAQ

 

english version   deutsche Version  

 

   controlling a remote
service (VBS)
 

 

 

Option Explicit

Dim sServer
Dim cmp1, cmp2

Set cmp1 = CreateObject("ntXdll.Computer")

MsgBox cmp1.InitComputerInfo("*", , , cmp1.SV_ENUM_ONLY, "MyPDC", "MyDomain")

For Each cmp2 In cmp1.Computers
        Watch cmp2.
CompName, "ServiceName"
Next

Sub Watch(sMachine, sService)

        On Error Resume Next

        Dim srv
        Dim lRes

        Set srv = CreateObject("ntXdll.Service")
        sServer = sMachine
        lRes = 0

        lRes = srv.InitServices(srv.SV_WIN32, sServer)

        If lRes = 0 Then
            MsgBox CStr(Now()) & vbCrLf & "error with InitServices: " & CStr(lRes) & " auf " & sMachine
            Exit Sub
        End If        

        If srv.Services(sService).CurrentState <> "SERVICE_RUNNING" Then
            MsgBox CStr(Now()) & vbCrLf & sService & " <> SERVICE_RUNNING on " & sMachine
        End If

End Sub

   
 Copyright © 1999-2003 Frank Seidel last update 09/27/2003  this site was created with Namo