Does anyone know why this would happen?
We find some users can run this code and some cannot - but we dont know why:
Code:
Set objSysInfo = CreateObject("ADSystemInfo")
objADUser = objSysInfo.UserName
Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some users
strUserF = objUser.FirstName
strUserL = objUser.LastName
strEmail = objUser.EmailAddress

Re: Active Directory GetObject function fails by Richard

Richard
Thu Mar 06 19:22:31 CST 2008


"mscertified" <rupert@tigerlily.com> wrote in message
news:481779DB-B0D9-4394-B166-42F3B64FB755@microsoft.com...
> Does anyone know why this would happen?
> We find some users can run this code and some cannot - but we dont know
> why:
> Code:
> Set objSysInfo = CreateObject("ADSystemInfo")
> objADUser = objSysInfo.UserName
> Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some
> users
> strUserF = objUser.FirstName
> strUserL = objUser.LastName
> strEmail = objUser.EmailAddress
>
>

The only reasons I can think of would be:

1. The user is not authenticated to an AD domain.
2. The client OS is not at least Windows 2000.
3. User lacks permission in AD (not likely).

If the client OS is Win9x or NT, you can use the wshNetwork object to
retrieve the NT name (pre-Windows 2000 logon name) of the user and then use
the NameTranslate object to convert this (in combination with the NetBIOS
name of the domain) to the Distinguished Name of the user.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



Re: Active Directory GetObject function fails by rupert

rupert
Fri Mar 07 12:31:00 CST 2008

Thanks for the response
We are using Windows XP with SP2
Do you know if certain DLLs are required? I have Activeds.dll but do not
have adslocator.dll

"Richard Mueller [MVP]" wrote:

>
> "mscertified" <rupert@tigerlily.com> wrote in message
> news:481779DB-B0D9-4394-B166-42F3B64FB755@microsoft.com...
> > Does anyone know why this would happen?
> > We find some users can run this code and some cannot - but we dont know
> > why:
> > Code:
> > Set objSysInfo = CreateObject("ADSystemInfo")
> > objADUser = objSysInfo.UserName
> > Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some
> > users
> > strUserF = objUser.FirstName
> > strUserL = objUser.LastName
> > strEmail = objUser.EmailAddress
> >
> >
>
> The only reasons I can think of would be:
>
> 1. The user is not authenticated to an AD domain.
> 2. The client OS is not at least Windows 2000.
> 3. User lacks permission in AD (not likely).
>
> If the client OS is Win9x or NT, you can use the wshNetwork object to
> retrieve the NT name (pre-Windows 2000 logon name) of the user and then use
> the NameTranslate object to convert this (in combination with the NetBIOS
> name of the domain) to the Distinguished Name of the user.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>

Re: Active Directory GetObject function fails by Richard

Richard
Fri Mar 07 14:13:43 CST 2008

All Microsoft operating systems from Windows 2000 on support ADSystemInfo. I
know from my work in vb that the file activeds.tlb is required. Are you
getting an error message? If so, what is it, and on which line is the error
raised?

If the error is raised on the "Set objUser" statement, then ADSystemInfo is
not the problem, since you were able to retrieve the value of
objSysInfo.UserName. What is the value of objSysInfo.UserName? Is it the
Distinguished Name of a value domain user?

If the user is not authenticated to a domain, then the line "objADUser =
objSysInfo.UserName" will raise an error.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
"mscertified" <rupert@tigerlily.com> wrote in message
news:7DAFB6A9-0DA1-413E-9D28-DD3D8B64B0FD@microsoft.com...
> Thanks for the response
> We are using Windows XP with SP2
> Do you know if certain DLLs are required? I have Activeds.dll but do not
> have adslocator.dll
>
> "Richard Mueller [MVP]" wrote:
>
>>
>> "mscertified" <rupert@tigerlily.com> wrote in message
>> news:481779DB-B0D9-4394-B166-42F3B64FB755@microsoft.com...
>> > Does anyone know why this would happen?
>> > We find some users can run this code and some cannot - but we dont know
>> > why:
>> > Code:
>> > Set objSysInfo = CreateObject("ADSystemInfo")
>> > objADUser = objSysInfo.UserName
>> > Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some
>> > users
>> > strUserF = objUser.FirstName
>> > strUserL = objUser.LastName
>> > strEmail = objUser.EmailAddress
>> >
>> >
>>
>> The only reasons I can think of would be:
>>
>> 1. The user is not authenticated to an AD domain.
>> 2. The client OS is not at least Windows 2000.
>> 3. User lacks permission in AD (not likely).
>>
>> If the client OS is Win9x or NT, you can use the wshNetwork object to
>> retrieve the NT name (pre-Windows 2000 logon name) of the user and then
>> use
>> the NameTranslate object to convert this (in combination with the NetBIOS
>> name of the domain) to the Distinguished Name of the user.
>>
>> --
>> Richard Mueller
>> Microsoft MVP Scripting and ADSI
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>>



Re: Active Directory GetObject function fails by rupert

rupert
Fri Mar 07 15:44:00 CST 2008

Line failing was indicated in my first post, error message is
"ActiveX component can't create object GetObject"
objADUser does have all the data in it separated by commas so the data was
accessed - just not parsed into invidual attributes

"Richard Mueller [MVP]" wrote:

> All Microsoft operating systems from Windows 2000 on support ADSystemInfo. I
> know from my work in vb that the file activeds.tlb is required. Are you
> getting an error message? If so, what is it, and on which line is the error
> raised?
>
> If the error is raised on the "Set objUser" statement, then ADSystemInfo is
> not the problem, since you were able to retrieve the value of
> objSysInfo.UserName. What is the value of objSysInfo.UserName? Is it the
> Distinguished Name of a value domain user?
>
> If the user is not authenticated to a domain, then the line "objADUser =
> objSysInfo.UserName" will raise an error.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
> "mscertified" <rupert@tigerlily.com> wrote in message
> news:7DAFB6A9-0DA1-413E-9D28-DD3D8B64B0FD@microsoft.com...
> > Thanks for the response
> > We are using Windows XP with SP2
> > Do you know if certain DLLs are required? I have Activeds.dll but do not
> > have adslocator.dll
> >
> > "Richard Mueller [MVP]" wrote:
> >
> >>
> >> "mscertified" <rupert@tigerlily.com> wrote in message
> >> news:481779DB-B0D9-4394-B166-42F3B64FB755@microsoft.com...
> >> > Does anyone know why this would happen?
> >> > We find some users can run this code and some cannot - but we dont know
> >> > why:
> >> > Code:
> >> > Set objSysInfo = CreateObject("ADSystemInfo")
> >> > objADUser = objSysInfo.UserName
> >> > Set objUser = Getobject("LDAP://" & objADUser) <=== Fails for some
> >> > users
> >> > strUserF = objUser.FirstName
> >> > strUserL = objUser.LastName
> >> > strEmail = objUser.EmailAddress
> >> >
> >> >
> >>
> >> The only reasons I can think of would be:
> >>
> >> 1. The user is not authenticated to an AD domain.
> >> 2. The client OS is not at least Windows 2000.
> >> 3. User lacks permission in AD (not likely).
> >>
> >> If the client OS is Win9x or NT, you can use the wshNetwork object to
> >> retrieve the NT name (pre-Windows 2000 logon name) of the user and then
> >> use
> >> the NameTranslate object to convert this (in combination with the NetBIOS
> >> name of the domain) to the Distinguished Name of the user.
> >>
> >> --
> >> Richard Mueller
> >> Microsoft MVP Scripting and ADSI
> >> Hilltop Lab - http://www.rlmueller.net
> >> --
> >>
> >>
> >>
>
>
>