Patrick
Sun Jul 06 16:31:14 CDT 2003
In case anybody would like to use this...here's the result.
It lists the state of services on a remote computer( in an other domain, it
asks for username an password) It displays them in an explorer window.
Patrick
Option Explicit
Dim strComputer, strUser, strPassword, objExplorer, objDocument
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 800
objExplorer.Height = 570
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
Do While (objExplorer.Busy)
Loop
Set objDocument = objExplorer.Document
objDocument.Open
objDocument.Writeln "<html><head><title>Service Status</title></head>"
objDocument.Writeln "<body bgcolor='white'>"
objDocument.Writeln "<table width='100%'>"
objDocument.Writeln "<tr>"
objDocument.Writeln "<td width='50%'><b>Service</b></td>"
objDocument.Writeln "<td width='50%'><b>State</b></td>"
objDocument.Writeln "</tr>"
Do
strComputer = inputbox( "Please enter computername (or . for local
host)", "Input" )
Loop until strComputer <> ""
Do
strUser = inputbox( "Please enter username", "Input" )
Loop until strUser <> ""
Do
strPassword = inputbox( "Please enter password", "Input" )
Loop until strPassword <> ""
ListShares strComputer, strUser, strPassword
WScript.Echo vbCrlf & "Ready."
Sub ListShares( strComputer, strUser, strPassword )
Dim strObject
Dim objLocator, objWMIService, objService
Dim colServices
Set objLocator = CreateObject( "WbemScripting.SWbemLocator" )
Set objWMIService = objLocator.ConnectServer ( strComputer,
"root/cimv2", strUser, strPassword )
objWMIService.Security_.impersonationlevel = 3
Set colServices = objWMIService.ExecQuery("SELECT State FROM
Win32_Service")
For Each objService in colServices
objDocument.Writeln "<tr>"
objDocument.Writeln "<td width='50%'>" & objService.Name & "</td>"
objDocument.writeln "<td width='50%'>" & objService.State & "</td>"
objDocument.Writeln "</tr>"
Next
objDocument.Writeln "</table>"
objDocument.Writeln "</body></html>"
objDocument.Write()
objDocument.Close
End Sub
"Patrick" <Patrick.fiten@skynet.be> wrote in message
news:3f078596$0$299$ba620e4c@reader0.news.skynet.be...
This is a script that works fine loccaly, but i want to use it on several
other server in all different domains.
How can i do this? (I tried to send the admin credentials along, but i am
doing something wrong. I can't get it to work)
So if anyone knows how to adjust this so i can use it, you would make my day
less frustrating ;-))
Thanks in advance
Patrick
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.493 / Virus Database: 292 - Release Date: 25/06/2003