Sorry, my post got sent before I was done. Continuing...
I assume you get the NT name from WshNetwork and need to
bind to the user object with the LDAP provider. A more
direct approach would be to use the NameTranslate object
to convert the NT name to the Distinguished Name. It can
also be used to convert the DNS domain name retrieved from
the RootDSE object to the NetBIOS domain name required for
NameTranslate to convert the NT name. The RootDSE object
is provided by AD. The NameTranslate object is available
on W2k and above, and any other client with DSClient
installed. I use the following:
Dim oRoot, oTrans, sNetBIOSDomain, oNet, sNTName, sAdsPath
Dim oGroupList, sGroup, oUser, sDNSDomain
Dim sComputer, oComputer, sComputerGroup
Set oNet = CreateObject("Wscript.Network")
' Loop required for Win9x clients during logon.
sNTName = ""
On Error Resume Next
Do While sNTName = ""
sNTName = oNet.UserName
If Wscript.Version > 5 Then
On Error GoTo 0
' Determine DNS domain name from RootDSE object.
Set oRoot = GetObject("LDAP://RootDSE")
sDNSDomain = oRoot.Get("DefaultNamingContext")
' Use the NameTranslate object to find the NetBIOS
' domain name from the DNS domain name.
Set oTrans = CreateObject("NameTranslate")
oTrans.Init 3, sDNSDomain
oTrans.Set 1, sDNSDomain
sNetBIOSDomain = oTrans.Get(3)
' Use the NameTranslate object to convert the NT user
' name to the Distinguished Name.
oTrans.Init 1, Left(sNetBIOSDomain, _
Len(sNetBIOSDomain) - 1)
oTrans.Set 3, sNetBIOSDomain & sNTName
sAdsPath = oTrans.Get(1)
' Bind to the user object in AD with the LDAP provider.
Set oUser = GetObject("LDAP://" & sAdsPath)
>>I've got the following Problem:
>>I wrote a User Loginscript with vbs. In this Script I
>>an ADODB Connection Object so I can search the AD for
>>Users own User Object.
>>Set Connection = CreateObject("ADODB.Connection")
>>Connection.Provider = "ADsDSOObject"
>>Connection.Open "Active Directory Provider"
>>Set rs = CreateObject("ADODB.Recordset")
>>When I run this script on some Clients I get error
>>800a0007 out of memory in the las line (Set
>>rs=CreateObject("ADODB.Recordset"). On other Clients the
>>script runs without Problems.....
>>All Information I get in Technet and the Internet are
>>concerned with ASP Programming.
>>Has anyone seen this problem before? And more
>>how can I solve this problem?
>>Thanx in advance..
>The code you posted did not raise an error on any of my
>machines, even with MDAC 2.1. Generally, ADO requires
>2.5 or above. Check the versions of msdadc.dll and
>oledb32.dll. Both should be at least 2.50.
>Also, you method is not efficient on very large networks.
>If you use ADO, I recommend using the GC as the base for
>the search. I assume you retrieve the user NT name
>(sAMAccountName) from the WshNetwork object and use Ad