HTA Script To Retrieve Your Local Computer And User OU Information

 

This HTA Script will allow you to see your local computer and logged on user account Organization (OU) Information.

 

HTA Script:

 

Set objExplorer = WScript.CreateObject("InternetExplorer.Application")

objExplorer.Navigate "About:Blank"

objExplorer.Document.Title = "Created By Don Hite For myITforum.Com"

objExplorer.ToolBar = 0

objExplorer.StatusBar = 0

objExplorer.Visible = 1

 

strHTML = "<table border='1' style='border-collapse: collapse' bordercolor='SaddleBrown' id='Table1' >"

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Computer</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>User</td>"

strHTML = strHTML & "</tr>"

 

Set objSysInfo = CreateObject("ADSystemInfo")

strComputerName = objSysInfo.ComputerName

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

strOUName = objComputer.Parent

Set objOU = GetObject(strOUName)

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%'>" & objOU.distinguishedName & "</td>"

 

Set objSysInfo = CreateObject("ADSystemInfo")

strUserName = objSysInfo.UserName

Set objUser = GetObject("LDAP://" & strUserName)

strOUName = objUser.Parent

Set objOU = GetObject(strOUName)

strHTML = strHTML & "<td width='10%'>" & objOU.distinguishedName   & "</td>"

 

strHTML = strHTML & "</tr>"

strHTML = strHTML & "</table>"

strHTML = strHTML & "</tr>"

strHTML = strHTML & "<p align='center'> <font color='Blue'>Please Visit myITforum.Com</p>"

strHTML = strHTML & "</tr>"

 

objExplorer.Document.Body.BgColor = "CornSilk"

objExplorer.Document.FgColor = "SaddleBrown"

objExplorer.Document.Body.InnerHTML = strHTML

 

 

 

Published Sunday, August 17, 2008 3:27 PM by dhite
Filed under:

Comments

No Comments