Hi!
Your script look good, but gives me an error:
"Object required :´objHTML´" and error code 800A01A8, Source Microsoft VBScript? In line 30 char7.
I cant see the error in your code, can see any typos or so?
Main Topics
Browse All TopicsIs there any "automatic" way to create web page, from information that is given in to Active Directory(AD)?Or some sort WMI query?
I would like to create automaticly a new page every time new user is added to AD.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ooops, yeah, typo....In the While loop I have
objHTML.WriteLine
but it should be
objHTMLFile.WriteLine
Please change the While loop to this:
While Not objRecordSet.EOF
objHTML.WriteLine "<TR><TD>Name: " & objRecordSet.Fields("name"
objHTML.WriteLine "<TR><TD>Title: " & objRecordSet.Fields("title
If objRecordSet.Fields("descr
objHTML.WriteLine "<TR><TD>Description: " & Join(objRecordSet.Fields("
Else
objHTML.WriteLine "<TR><TD>Description: </TD></TR>"
End If
objRecordSet.MoveNext
Wend
Regards,
Rob.
OK, there was another error there with the description....this will work:
'====================
strSamAccountName = InputBox("Please enter the username to generate a page for:", "Username")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connec
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Comman
objCommand.ActiveConnectio
objCommand.Properties("Pag
objCommand.Properties("Tim
objCommand.Properties("Sea
objCommand.Properties("Cac
Set objRootDSE = GetObject("LDAP://RootDSE"
objCommand.CommandText = "SELECT name,title,description FROM " & _
"'LDAP://" & objRootDSE.Get("defaultNam
"objectCategory='person' AND objectClass='user' AND samAccountName='" & strSamAccountName & "'"
Set objRecordSet = objCommand.Execute
Set objFSO = CreateObject("Scripting.Fi
Set objHTMLFile = objFSO.CreateTextFile(strS
objHTMLFile.WriteLine "<HTML>"
objHTMLFile.WriteLine "<HEAD>"
objHTMLFile.WriteLine "</HEAD>"
objHTMLFile.WriteLine "<BODY>"
objHTMLFile.WriteLine "<H2>Web page for " & strSamAccountNAme & "</H2>"
objHTMLFile.WriteLine "<TABLE>"
While Not objRecordSet.EOF
objHTMLFile.WriteLine "<TR><TD>Name: " & objRecordSet.Fields("name"
objHTMLFile.WriteLine "<TR><TD>Title: " & objRecordSet.Fields("title
If IsNull(objRecordSet.Fields
objHTMLFile.WriteLine "<TR><TD>Description: " & Join(objRecordSet.Fields("
Else
objHTMLFile.WriteLine "<TR><TD>Description: </TD></TR>"
End If
objRecordSet.MoveNext
Wend
objHTMLFile.WriteLine "</TABLE>"
objHTMLFile.WriteLine "</BODY>"
objHTMLFile.WriteLine "</HTML>"
objHTMLFile.Close
Set objHTMLFile = Nothing
MsgBox "Finished. Please see " & strSamAccountName & ".htm"
'====================
Regards,
Rob.
Business Accounts
Answer for Membership
by: RobSampsonPosted on 2008-01-11 at 16:48:40ID: 20642100
Here's a quick example that will get the name, title, and description of a username that you enter. I haven't tested it yet, so hopefully it runs without errors.
tion") d") n = objConnection e Size") = 1000 eout") = 600 rchscope") = ADS_SCOPE_SUBTREE he Results") = False
) ingContext ") & "' WHERE " & _
leSystemOb ject") amAccountN ame & ".htm", True) ).Value & "</TD></TR>" ").Value & "</TD></TR>" iption").V alue <> Null Then descriptio n").Value) & "</TD></TR>"
'====================
strSamAccountName = InputBox("Please enter the username to generate a page for:", "Username")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connec
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand = CreateObject("ADODB.Comman
objCommand.ActiveConnectio
objCommand.Properties("Pag
objCommand.Properties("Tim
objCommand.Properties("Sea
objCommand.Properties("Cac
Set objRootDSE = GetObject("LDAP://RootDSE"
objCommand.CommandText = "SELECT name,title,description FROM " & _
"'LDAP://" & objRootDSE.Get("defaultNam
"objectCategory='person' AND objectClass='user' AND samAccountName='" & strSamAccountName & "'"
Set objRecordSet = objCommand.Execute
Set objFSO = CreateObject("Scripting.Fi
Set objHTMLFile = objFSO.CreateTextFile(strS
objHTMLFile.WriteLine "<HTML>"
objHTMLFile.WriteLine "<HEAD>"
objHTMLFile.WriteLine "</HEAD>"
objHTMLFile.WriteLine "<BODY>"
objHTMLFile.WriteLine "<H2>Web page for " & strSamAccountNAme & "</H2>"
objHTMLFile.WriteLine "<TABLE>"
While Not objRecordSet.EOF
objHTML.WriteLine "<TR><TD>Name: " & objRecordSet.Fields("name"
objHTML.WriteLine "<TR><TD>Title: " & objRecordSet.Fields("title
If objRecordSet.Fields("descr
objHTML.WriteLine "<TR><TD>Description: " & Join(objRecordSet.Fields("
Else
objHTML.WriteLine "<TR><TD>Description: </TD></TR>"
End If
objRecordSet.MoveNext
Wend
objHTMLFile.WriteLine "</TABLE>"
objHTMLFile.WriteLine "</BODY>"
objHTMLFile.WriteLine "</HTML>"
objHTMLFile.Close
Set objHTMLFile = Nothing
MsgBox "Finished. Please see " & strSamAccountName & ".htm"
'====================
Regards,
Rob.