Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Directory info displayed on a web page

Status
Not open for further replies.

FAM

Technical User
Jan 13, 2003
345
GB
Hi,

I currently use the following vbs code which querys AD and tells the user their PIN number which is located in their PO Box field in AD.

It works fine but i want to output it onto a web page (html or aspx) but i am struggling to get it working as i thought it would of just been a case of using
<script type="text/vbscript"></script>

The working code is,
Code:
Set objRootDSE = GetObject("LDAP://RootDSE")
If Err.Number = 0 Then
    strNamingContext = objRootDSE.Get("defaultNamingContext")

Else
    WScript.Echo("Unable to connect to Active Directory." & vbCrLf & "Exiting Script." & vbCrLf)
    objShell.Popup line, 10, vbTab & "Logon Script", 48
    objLogFile.Close
    Wscript.Quit
End If

Set objADSysInfo = CreateObject("ADSystemInfo")
strUserDN = objADSysInfo.username

' Bind to user object
Set objUser = Getobject("LDAP://" & strUserDN)
'WScript.Echo "User ID:    " & objUser.Get("name") 
WScript.Echo "Hello " & objUser.Get("name") & ", your photocopier PIN is: " & objUser.Get("postOfficeBox")
Any advice where i am going wrong?

Thanks
 
>but i am struggling to get it working as i thought it would of just been a case of using
><script type="text/vbscript"></script>
Not really. WScript is internal object hosted by wscript.exe/cscript.exe. It is not recognized by the parties involved in the functioning of a html page. So, as a start, eliminate all the reference to wscript and replace the corresponding functionality scriptable in the host of browsers if it is client-side or of webservers if it is meant to be server-side operation. Further, you have running context to determine, server-side or client-side (html/hta?). Then you have the permission issue to determine. Brief, your thought is deficient.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top