r_hagrid
asked on
ASP GetObject("WinNT://") no longer works after upgrading to Windows 2003 domain
I just upgraded my domain from a Windows 2000 domain to a Windows 2003 domain and now when the below code is ran from my webserver it doesn't return the requested data from Active Directory.
<%
strUser= Replace(Request.ServerVari ables("LOG ON_USER"), "\", "/")
On Error Resume Next
Set xUser = GetObject("WinNT://" & strUser & ",user")
usrUserName = xUser.Name
usrFullname = xUser.Fullname
nameArray = Split(usrFullname, " ", -1, 1)
usrFirstName = nameArray(LBound(nameArray ))
usrLastName = nameArray(UBound(nameArray ))
usrPhone = xUser.Description
For Each grp In xUser.Groups
If Left(grp.Name,5) = "Dept_" then
usrGroup = grp.Name
End If
Next
'Print to screen for testing
Response.Write "strUser : " & strUser & "<br>"
Response.Write "Username : " & usrUserName & "<br>"
Response.Write "Full Name: " & usrFullname & "<br>"
Response.Write "First Name: " & usrFirstName & "<br>"
Response.Write "Last Name: " & usrLastName & "<br>"
Response.Write "Description: " & usrDescription & "<br>"
Response.Write "Group: " & usrGroup & "<br><br>"
For Each grp In xUser.Groups
Response.Write "Group: " & grp.Name & "<br>"
Next
%>
My Domain Controller is Windows 2003
My webserver is Windows 2000 Latest SP and updates
The user is forced to login to this page with Windows autentication ,which is how I get the user name.
The <DOMAIN>/<USERNAME> is returned just fine from the Request.ServerVariables call
The above code worked fine before I upgraded the domain, that has been the only change.
No changes were made to the Windows 2000 web server
All other aspects of my environment work fine, no errors
Please help,
JWB
<%
strUser= Replace(Request.ServerVari
On Error Resume Next
Set xUser = GetObject("WinNT://" & strUser & ",user")
usrUserName = xUser.Name
usrFullname = xUser.Fullname
nameArray = Split(usrFullname, " ", -1, 1)
usrFirstName = nameArray(LBound(nameArray
usrLastName = nameArray(UBound(nameArray
usrPhone = xUser.Description
For Each grp In xUser.Groups
If Left(grp.Name,5) = "Dept_" then
usrGroup = grp.Name
End If
Next
'Print to screen for testing
Response.Write "strUser : " & strUser & "<br>"
Response.Write "Username : " & usrUserName & "<br>"
Response.Write "Full Name: " & usrFullname & "<br>"
Response.Write "First Name: " & usrFirstName & "<br>"
Response.Write "Last Name: " & usrLastName & "<br>"
Response.Write "Description: " & usrDescription & "<br>"
Response.Write "Group: " & usrGroup & "<br><br>"
For Each grp In xUser.Groups
Response.Write "Group: " & grp.Name & "<br>"
Next
%>
My Domain Controller is Windows 2003
My webserver is Windows 2000 Latest SP and updates
The user is forced to login to this page with Windows autentication ,which is how I get the user name.
The <DOMAIN>/<USERNAME> is returned just fine from the Request.ServerVariables call
The above code worked fine before I upgraded the domain, that has been the only change.
No changes were made to the Windows 2000 web server
All other aspects of my environment work fine, no errors
Please help,
JWB
ASKER
Great idea joeposter649!
I did what you suggested and ran your script.vbs file from the 2000 box and it worked just fine. It works fine from any box in my environment.
So what does that tell me?
It isn't the GetObject is it?
So I though maybe IIS...
I moved the website from the 2000 server to a 2003 server and it works if I access it from a windows 2003 system, but not from XP or 2000 pro. This is getting very confusing.
Maybe I need to change the way I access active directory? Does anyone have any good examples to get the data I am refering to in the above code?
Thanks!!!
-JWB
I did what you suggested and ran your script.vbs file from the 2000 box and it worked just fine. It works fine from any box in my environment.
So what does that tell me?
It isn't the GetObject is it?
So I though maybe IIS...
I moved the website from the 2000 server to a 2003 server and it works if I access it from a windows 2003 system, but not from XP or 2000 pro. This is getting very confusing.
Maybe I need to change the way I access active directory? Does anyone have any good examples to get the data I am refering to in the above code?
Thanks!!!
-JWB
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It was the iusr accounts that were causing the problem. Thank you so much for opening my eyes. Who knows how long I would have gone without even checking them.
You all were great help and coopzz if you wouldn't mind posting some samples on a better way to do what I am trying I would really appreciate it.
Again thanks for your time!
-JWB
You all were great help and coopzz if you wouldn't mind posting some samples on a better way to do what I am trying I would really appreciate it.
Again thanks for your time!
-JWB
No nessacery a better way just a new way..
heres just some info I've provided somewhere else on the matter
https://www.experts-exchange.com/questions/21138580/LDAP-Code-to-get-Active-Directory-Groups.html
the reason it's more complex is because your looking at you active directory structure.
theres also plenty of examples out there
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnactdir/html/BuildingADApps.asp
http://www.freevbcode.com/ShowCode.asp?ID=710
http://www.codeguru.com/forum/showthread.php?t=305150&goto=nextnewest
http://www.google.com.au/search?q=ldap+active+directory+vb
cheers have fun.
heres just some info I've provided somewhere else on the matter
https://www.experts-exchange.com/questions/21138580/LDAP-Code-to-get-Active-Directory-Groups.html
the reason it's more complex is because your looking at you active directory structure.
theres also plenty of examples out there
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnactdir/html/BuildingADApps.asp
http://www.freevbcode.com/ShowCode.asp?ID=710
http://www.codeguru.com/forum/showthread.php?t=305150&goto=nextnewest
http://www.google.com.au/search?q=ldap+active+directory+vb
cheers have fun.
Set oUser = GetObject("WinNT://Yourdom
WScript.Echo(oUser.Name)
set oUser=nothing
Then try it as an asp page.