hi,
habe von einem kollegen eine vorlage bekommen für ein script, welches alle dc ausgibt.
nun möchte ich jeden dc nach einem bestimmten dienst abfragen, und den status dann mit dem namen des dc in eine liste schreiben.
ich hab schon lange nichts mehr mit vb zu tun gehabt, daher bitte ich um hilfe.
mein teil, der noch nicht funktioniert, ist FETT. wäre wohl zu einfach. unter dem script ist auch gleich das originalscript.
hilfe wäre suuuuuuuuuuuper. danke
' EnumDCs.vbs
' VBScript program to enumerate all Domain Controllers in the domain.
'
' ----------------------------------------------------------------------
' Copyright (c) 2002 Richard L. Mueller
' Hilltop Lab web site -
Hilltop Lab
' Version 1.0 - November 10, 2002
' Version 1.1 - February 19, 2003 - Standardize Hungarian notation.
' Version 1.2 - March 11, 2003 - Remove SearchScope property.
'
' Program enumerates all Domain Controllers, their DNS host name, and
' the name of the site they reside in.
'
' You have a royalty-free right to use, modify, reproduce, and
' distribute this script file in any way you find useful, provided that
' you agree that the copyright owner above has no warranty, obligations,
' or liability for such use.
Option Explicit
Dim objRootDSE, strConfig, adoConnection, adoCommand, strQuery
Dim adoRecordset, objDC, objSite
' Determine configuration context from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get("configurationNamingContext")
' Use ADO to search Active Directory for ObjectClass nTDSDSA.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strQuery = "<LDAP://" & strConfig _
& ">;(ObjectClass=nTDSDSA);AdsPath;subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
' The parent object of each object with ObjectClass=nTDSDSA is a Domain
' Controller. The parent of each Domain Controller is a "Servers"
' container, and the parent of this container is the "Site" container.
Do Until adoRecordset.EOF
Set objDC = GetObject( _
GetObject(adoRecordset.Fields("AdsPath").Value).Parent)
Set objSite = GetObject(GetObject(objDC.Parent).Parent)
cmd("sc query "Automatisches LiveUpdate - Scheduler" >> C:\test.txt ")
adoRecordset.MoveNext
Loop
adoRecordset.Close
' Clean up.
adoConnection.Close
Set objRootDSE = Nothing
Set adoCommand = Nothing
Set adoConnection = Nothing
Set adoRecordset = Nothing
Set objDC = Nothing
Set objSite = Nothing
Wscript.Echo "Done"
----------------originalscript - auszug - ohne meine änderungen. (fett hab ich gelöscht)
GetObject(adoRecordset.Fields("AdsPath").Value).Parent)
Set objSite = GetObject(GetObject(objDC.Parent).Parent)
Wscript.Echo "Domain Controller: " & objDC.cn & vbCrLf _
& "DNS Host Name: " & objDC.DNSHostName & vbCrLf _
& "Site: " & objSite.name
adoRecordset.MoveNext