T
Tcs
This is probably one of those really simple things, but I don't know what my
problem is, so here goes...
I'm trying to use a .vbs script to enumerate all the computers in my domain. (We
have an old NT4 domain with 2 DCs, and one new w2k3 domain with 2 DCs.) All
users have been moved to the new domain. Most clients and the NT4 DCs are still
in the old domain. My PC is in the new domain.
Whenever I try to run my scripts (I've tried several [alledgedly] working
scripts) they all error out. The error that *seems* to be the most telling is:
The specified domain either does not exist or could not be contacted.
I've tried both specifying a domain name, and not. (I don't really think that
I'm supposed to.) Something is apparently wrong, but I don't know what. I've
been playing with this for quite some time, and have *sort of* narrowed it down
to something about the 'LDAP' statement. One website mentioned something about
it *probably* being a syntax error, or something likewise simple. Here's my
code:
----------code----------
' Get Domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = "LDAP://" & objRootDSE.Get("defaultNamingContext")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select printerName, serverName from 'LDAP://' &
strDomain where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
objRecordSet.MoveNext
Loop
----------code----------
I've also tried netdom. (I found reference to it in the scripting group.) Makes
no difference if I try to query the new or old domain, it says it was
unsuccessful.
I can 'remote desktop' to the servers, and it looks like Active directory is
working to me, but I'm not really the network guy.
Would anyone happen to know how I might try to find what my problem is? And
even possibly how I might fix it?
Any help is appreciated, thanks in advance,
Tom
problem is, so here goes...
I'm trying to use a .vbs script to enumerate all the computers in my domain. (We
have an old NT4 domain with 2 DCs, and one new w2k3 domain with 2 DCs.) All
users have been moved to the new domain. Most clients and the NT4 DCs are still
in the old domain. My PC is in the new domain.
Whenever I try to run my scripts (I've tried several [alledgedly] working
scripts) they all error out. The error that *seems* to be the most telling is:
The specified domain either does not exist or could not be contacted.
I've tried both specifying a domain name, and not. (I don't really think that
I'm supposed to.) Something is apparently wrong, but I don't know what. I've
been playing with this for quite some time, and have *sort of* narrowed it down
to something about the 'LDAP' statement. One website mentioned something about
it *probably* being a syntax error, or something likewise simple. Here's my
code:
----------code----------
' Get Domain name from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain = "LDAP://" & objRootDSE.Get("defaultNamingContext")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "Select printerName, serverName from 'LDAP://' &
strDomain where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
objRecordSet.MoveNext
Loop
----------code----------
I've also tried netdom. (I found reference to it in the scripting group.) Makes
no difference if I try to query the new or old domain, it says it was
unsuccessful.
I can 'remote desktop' to the servers, and it looks like Active directory is
working to me, but I'm not really the network guy.
Would anyone happen to know how I might try to find what my problem is? And
even possibly how I might fix it?
Any help is appreciated, thanks in advance,
Tom