Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm looking for code that will display the computers OU name on a webpage for my job. The webpage is an ASP.net page. This infomation will be display on the screen after the page is loaded.
Posted
Updated 19-Sep-12 9:06am
v2
Comments
[no name] 19-Sep-12 11:39am    
Thanks for keeping us updated on your progress. Seems more like a blog entry rather than something for QA though.

1 solution

Here is the reference code:

VB
Set objSysInfo = CreateObject("ADSystemInfo")
strComputer = objSysInfo.ComputerName

Set objComputer = GetObject("LDAP://" & strComputer)

arrOUs = Split(objComputer.Parent, ",")
arrMainOU = Split(arrOUs(0), "=")

Wscript.Echo arrMainOU(1)
 
Share this answer
 
Comments
Member 9441994 20-Sep-12 16:52pm    
thanks. I try this and I got some error messages in the code. I'm using VB code in an ASP.net page. Does this make a differance?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900