Reputation: 10004
I'm getting undefined object CreateObject("ADSystemInfo") when I embed the code in classical asp that is hosted in IIS7.0 on Windows Server 2008. When I excute the same code on that server using VBscript it is working fine. Could some one help me. I need to know if I need to make any server settings changes
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUserDN)
arrGroups = objUser.memberOf
Upvotes: 1
Views: 2426
Reputation: 25346
This is because what you wrote about is actually VBScript, and not Classic ASP.
You can run this from the cmd window and it should work fine. But to convert it to ASP, you have to do a couple things.
Surround your code with
<%
... code here
%>
And then change every instance of CreateObject
to Server.CreateObject
Your code would look like this:
<%
Set objSysInfo = Server.CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUserDN)
arrGroups = objUser.memberOf
%>
Finally, make sure that the IIS webserver is running as a user that has the correct permissions.
Upvotes: 2