bsharath
asked on
Active directory query Hta script
Hi,
Here is a ADS Q thats being created by "Rejoiner"
Need these additions.
1.Need a box below seat no same as the Replace machine box New Seat NO
2.Need to comment the Address,City,State,Zip code,Country,Home phone no So these boxes are not visible and have no action in the Hta.When required I can un comment these in the code. Need some headers so can recognize them.
3.When type a name in the group membership or subordinates it has to go to the particular data.
4.When typed the replacement machine data all the fields become disabled for editing. Can it be open for me to enter more data on the particular field
5.Computer Description (Pending)
6.When selected a subject or a profile the pre set email ids have to be resolved to the To & CC (Pending)
7.Can we have 2 boxes 1 for Distribution and 1 for security groups .This would be so useful to take report of them.
8.Can we have 2 boxes 1 for local groups & another for root groups (for 7 & 8) I dont mind if I need to scroll to the right because of space constrain. These 2 options would be useful to differentiate and add/remove groups later on.
9.Root Domain Groups when querying a use (pending)
10Import from Excel (Pending)
11.Once opened the Hta be able to export Save to all groups be saved to the Csv
Regards
Sharath
Here is a ADS Q thats being created by "Rejoiner"
Need these additions.
1.Need a box below seat no same as the Replace machine box New Seat NO
2.Need to comment the Address,City,State,Zip code,Country,Home phone no So these boxes are not visible and have no action in the Hta.When required I can un comment these in the code. Need some headers so can recognize them.
3.When type a name in the group membership or subordinates it has to go to the particular data.
4.When typed the replacement machine data all the fields become disabled for editing. Can it be open for me to enter more data on the particular field
5.Computer Description (Pending)
6.When selected a subject or a profile the pre set email ids have to be resolved to the To & CC (Pending)
7.Can we have 2 boxes 1 for Distribution and 1 for security groups .This would be so useful to take report of them.
8.Can we have 2 boxes 1 for local groups & another for root groups (for 7 & 8) I dont mind if I need to scroll to the right because of space constrain. These 2 options would be useful to differentiate and add/remove groups later on.
9.Root Domain Groups when querying a use (pending)
10Import from Excel (Pending)
11.Once opened the Hta be able to export Save to all groups be saved to the Csv
Regards
Sharath
<head>
<title>User Information</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information"
BORDER="thin"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="MAXIMIZE"
ID="oHTA"
>
</head>
<script language="VBScript">
Const adVarChar = 200
Const VarCharMaxCharacters = 255
Dim strEmailBCC
Dim strEmailServer
Dim arrSubjectText
strEmailBCC = "" 'Enter the BCC field as "Your Name <youremail@yourdomain.com>"
strEmailServer = "MAILSERVER" 'Exchange server name
arrSubjectText = array("This is subject text #1","This is subject text #2","This is subject text #3","This is subject text #4")
strEmailFrom = "" 'Leave Blank if the HTA should determine email address automatically
Dim arrRows
Dim strEmailFrom
Dim strEmailTo
Dim strEmailCC
Dim DataList
Dim sUserName
Dim sDistName
Dim strDNSDomain
Dim globalstrSearchField
Dim globalstrSearchBtnPush
Dim FileName
Dim fModif
Dim LastChildMenu
Dim LastMenu
Dim globalstrQueryBuilder
If strEmailFrom = "" Then
strEmailFrom = mid(GetEmailAddresses(GetUsersEmailAddress),1,len(GetEmailAddresses(GetUsersEmailAddress))-1)
strEmailFrom = GetUsersEmailAddress & " <" & strEmailFrom & ">" 'Getting email address from logged on user
End if
strEmailTo = GetUsersEmailAddress 'Get user name of logged on user so there is a default value when launched
strEmailCC = ""
DisplayTitle
Set LastChildMenu = Nothing
Set LastMenu = Nothing
Set oShell = CreateObject("WScript.Shell")
fTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
fAppData = oShell.ExpandEnvironmentStrings("%APPDATA%")
Sub Window_OnLoad
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = True
btnEMailAllRecords.Disabled = True
btnEmailAsAttachment.Disabled = True
txt_EmailTo.Value = strEmailTo
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
FillGroupList
FillSubjectList
GetChkProfiles
End Sub
Sub Clear_Form
txt_seatno.Value = ""
txt_seatno.style.backgroundColor="#FFFFFF"
txt_seatno.Disabled = False
txt_building.Value = ""
txt_building.style.backgroundColor="#FFFFFF"
txt_building.Disabled = False
txt_extensionno.Value = ""
txt_extensionno.style.backgroundColor="#FFFFFF"
txt_extensionno.Disabled = False
txt_empid.Value = ""
txt_empid.style.backgroundColor="#FFFFFF"
txt_empid.Disabled = False
txt_department.Value = ""
txt_department.style.backgroundColor="#FFFFFF"
txt_department.Disabled = False
txt_designation.Value = ""
txt_designation.style.backgroundColor="#FFFFFF"
txt_designation.Disabled = False
txt_name.Value = ""
txt_name.style.backgroundColor="#FFFFFF"
txt_name.Disabled = False
txt_loginname.Value = ""
txt_loginname.style.backgroundColor="#FFFFFF"
txt_loginname.Disabled = False
txt_email.Value = ""
txt_email.style.backgroundColor="#FFFFFF"
txt_email.Disabled = False
txt_notes.Value = ""
txt_notes.style.backgroundColor="#FFFFFF"
txt_notes.Disabled = False
txt_replacedmachine.Value = ""
txt_replacedmachine.Disabled = False
txt_replacedmachine.style.backgroundcolor="#FFFFFF"
txt_oupathcomputer.Value = ""
txt_oupathcomputer.style.backgroundColor="#FFFFFF"
txt_oupathcomputer.Disabled = False
txt_computeros.Value = ""
txt_computeros.Style.backgroundColor="#FFFFFF"
txt_computeros.Disabled = False
txt_computerservicepack.Value = ""
txt_computerservicepack.Style.backgroundColor="#FFFFFF"
txt_computerservicepack.Disabled = False
txt_computercreated.Value = ""
txt_computercreated.Style.backgroundColor="#FFFFFF"
txt_computercreated.Disabled = False
txt_computerdescription.Value = ""
txt_computerdescription.Style.backgroundColor="#FFFFFF"
txt_computerdescription.Disabled = False
txt_mobileno.Value = ""
txt_mobileno.style.backgroundColor="#FFFFFF"
txt_mobileno.Disabled = False
txt_company.Value = ""
txt_company.style.backgroundColor="#FFFFFF"
txt_company.Disabled = False
txt_address.Value = ""
txt_address.style.backgroundColor="#FFFFFF"
txt_address.Disabled = False
txt_city.Value = ""
txt_city.style.backgroundColor="#FFFFFF"
txt_city.Disabled = False
txt_state.Value = ""
txt_state.style.backgroundColor="#FFFFFF"
txt_state.Disabled = False
txt_zipcode.Value = ""
txt_zipcode.style.backgroundColor="#FFFFFF"
txt_zipcode.Disabled = False
txt_country.Value = ""
txt_country.style.backgroundColor="#FFFFFF"
txt_country.Disabled = False
txt_homephone.Value = ""
txt_homephone.style.backgroundColor="#FFFFFF"
txt_homephone.Disabled = False
txt_manager.Value = ""
txt_manager.style.backgroundColor="#FFFFFF"
txt_manager.Disabled = False
txt_managerseen.Value = ""
txt_managerseen.style.backgroundColor="#FFFFFF"
txt_managerseen.Disabled = False
txt_whencreated.Value = ""
txt_whencreated.style.backgroundColor="#FFFFFF"
txt_whencreated.Disabled = False
txt_oupathuser.Value = ""
txt_oupathuser.style.backgroundColor="#FFFFFF"
txt_oupathuser.Disabled = False
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
End Sub
Sub Submit_Form(btnPush)
arrFields = Array(_
"txt_seatno", _
"txt_building", _
"txt_extensionno", _
"txt_empid", _
"txt_department", _
"txt_designation", _
"txt_name", _
"txt_loginname", _
"txt_email", _
"txt_notes", _
"txt_mobileno", _
"txt_company", _
"txt_address", _
"txt_city", _
"txt_state", _
"txt_zipcode", _
"txt_country", _
"txt_homephone", _
"txt_managerseen", _
"txt_whencreated" _
)
boolValid = False
For Each strField In arrFields
If Eval(strField & ".Disabled") = True Then
boolValid = True
End If
If Eval(strField & ".Disabled") = False Then
strCurrentField = strField
End If
Next
If boolValid = False Then strCurrentField = "INVALID"
Select Case strCurrentField
Case "txt_seatno"
If txt_seatno.Value = "" Then
strSearchField = "(info=*)"
Else
strSearchField = "(info=*" & txt_seatno.Value & "*)"
End If
Case "txt_building"
If txt_building.Value = "" Then
strSearchField = "(physicalDeliveryOfficeName=*)"
Else
strSearchField = "(physicalDeliveryOfficeName=*" & txt_building.Value & "*)"
End If
Case "txt_extensionno"
If txt_extensionno.Value = "" Then
strSearchField = "(telephoneNumber=*)"
Else
strSearchField = "(telephoneNumber=*" & txt_extensionno.Value & "*)"
End If
Case "txt_empid"
If txt_empid.Value = "" Then
strSearchField = "(description=*)"
Else
strSearchField = "(description=*" & txt_empid.Value & "*)"
End If
Case "txt_department"
If txt_department.Value = "" Then
strSearchField = "(department=*)"
Else
strSearchField = "(department=*" & txt_department.Value & "*)"
End If
Case "txt_designation"
If txt_designation.Value = "" Then
strSearchField = "(title=*)"
Else
strSearchField = "(title=*" & txt_designation.Value & "*)"
End If
Case "txt_name"
If txt_name.Value = "" Then
strSearchField = "(cn=*)"
Else
strSearchField = "(cn=*" & txt_name.Value & "*)"
End If
Case "txt_loginname"
If txt_loginname.Value = "" Then
strSearchField = "(samAccountName=*)"
Else
strSearchField = "(samAccountName=*" & txt_loginname.Value & "*)"
End If
Case "txt_email"
If txt_email.Value = "" Then
strSearchField = "(mail=*)"
Else
strSearchField = "(mail=*" & txt_email.Value & "*)"
End If
Case "txt_notes"
If txt_notes.Value = "" Then
strSearchField = "(info=*)"
Else
strSearchField = "(info=*" & txt_notes.Value & "*)"
End If
Case "txt_mobileno"
If txt_mobileno.Value = "" Then
strSearchField = "(mobile=*)"
Else
strSearchField = "(mobile=*" & txt_mobileno.Value & "*)"
End If
Case "txt_company"
If txt_company.Value = "" Then
strSearchField = "(company=*)"
Else
strSearchField = "(company=*" & txt_company.Value & "*)"
End If
Case "txt_address"
If txt_address.Value = "" Then
strSearchField = "(streetAddress=*)"
Else
strSearchField = "(streetAddress=*" & txt_address.Value & "*)"
End If
Case "txt_city"
If txt_city.Value = "" Then
strSearchField = "(l=*)"
Else
strSearchField = "(l=*" & txt_city.Value & "*)"
End If
Case "txt_state"
If txt_state.Value = "" Then
strSearchField = "(st=*)"
Else
strSearchField = "(st=*" & txt_state.Value & "*)"
End If
Case "txt_zipcode"
If txt_zipcode.Value = "" Then
strSearchField = "(postalCode=*)"
Else
strSearchField = "(postalCode=*" & txt_zipcode.Value & "*)"
End If
Case "txt_country"
If txt_country.Value = "" Then
strSearchField = "(c=*)"
Else
strSearchField = "(c=*" & txt_country.Value & "*)"
End If
Case "txt_homephone"
If txt_homephone.Value = "" Then
strSearchField = "(homePhone=*)"
Else
strSearchField = "(homePhone=*" & txt_homephone.Value & "*)"
End If
Case "txt_managerseen"
If txt_managerseen.Value = "" Then
strSearchField = "(manager=*)"
Else
strSearchField = GetManagerDN(txt_managerseen.Value)
End If
Case "txt_whencreated"
If txt_whencreated.Value = "" Then
strSearchField = "(whenCreated=*)"
Else
if NOT IsDate(txt_whencreated.Value) then
msgbox "Invalid date - enter as dd/mm/yyyy"
strSearchField = "INVALID"
else
strWhenCreated = Year(txt_whencreated.Value) & Right("0" & Month(txt_whencreated.Value), 2) & Right("0" & Day(txt_whencreated.Value), 2)
strSearchField = "(whenCreated>=" & strWhenCreated & "000000.0Z)(whenCreated<=" & strWhenCreated & "235959.0Z)"
end if
End If
Case Else
strSearchField = "INVALID"
End Select
if btnPush = "Disabled" then
strSearchField = "(samAccountName=*)"
end if
if btnPush = "Group" then
For i = 0 to (lst_groupnames.Options.Length - 1)
If (lst_groupnames.Options(i).Selected) Then
arrGroupNames = split(lst_groupnames.Options(i).Value,";")
sprimaryGroupID = arrGroupNames(0)
sMemberOf = arrGroupNames(1)
End If
Next
if sprimaryGroupID = 513 then
strSearchField = "(primaryGroupID=" & sprimaryGroupID & ")"
else
strSearchField = "(memberOf=" & sMemberOf & ")"
end if
end if
if btnPush = "Subordinate" then
For i = 0 to (lst_subordinates.Options.Length - 1)
If (lst_subordinates.Options(i).Selected) Then
arrSubordinateNames = split(lst_subordinates.Options(i).Value,";")
strSearchField = "(samAccountName=*" & arrSubordinateNames(0) & "*)"
End If
Next
end if
if btnPush = "DisabledToday" then
strWhenChanged = Year(txt_whencreated.Value) & Right("0" & Month(txt_whencreated.Value), 2) & Right("0" & Day(txt_whencreated.Value), 2)
strSearchField = "(samAccountName=*)(whenChanged>=" & strWhenChanged & "000000.0Z)(whenChanged<=" & strWhenChanged & "235959.0Z)"
end if
if btnPush = "FileOpen" then
strSearchField = globalStrSearchField
btnPush = globalStrSearchBtnPush
End if
Clear_Form
If strSearchField <> "INVALID" Then
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
'strFilter = "(&(objectClass=computer)(cn=" & strComputer & "))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "physicalDeliveryOfficeName,TelephoneNumber,description,Department,Title,cn,samAccountName,mail,Info,Mobile,company,streetAddress,l,st,postalCode,c,homePhone,manager,whenCreated,distinguishedName,userAccountControl"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
strDetails = ""
If Not adoRecordset.EOF Then
Do Until adoRecordset.EOF
if btnPush = "Disabled" OR btnPush = "DisabledToday" then
if adoRecordset.Fields("userAccountControl").Value AND 2 then
If strDetails <> "" Then strDetails = strDetails & "|TR|"
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If InStr(LCase(adoRecordset.Fields("Info").Value), "location : ") > 0 Then
strBuilding = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), "location : ")))
strBuilding = Mid(strBuilding, 12)
Else
strBuilding = ""
End If
strDetails = strDetails & replace(strBuilding,vbCRLF,"")
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
"|TD|" & adoRecordset.Fields("TelephoneNumber").Value
If IsNull(adoRecordset.Fields("Description").Value) = False Then
strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value &_
"|TD|" & adoRecordset.Fields("Title").Value &_
"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("mail").Value
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If Left(LCase(adoRecordset.Fields("Info").Value), 15) = LCase("Machine Name : ") Then
strInfo = Trim(Mid(adoRecordset.Fields("Info").Value, 15))
strInfo = Replace(UCase(strInfo), UCase("Location : " & strBuilding), "")
Else
strInfo = adoRecordset.Fields("Info").Value
End If
strDetails = strDetails & "|TD|" & replace(strInfo,vbCRLF,"")
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
"|TD|" & adoRecordset.Fields("company").Value &_
"|TD|" & adoRecordset.Fields("streetAddress").Value &_
"|TD|" & adoRecordset.Fields("l").Value &_
"|TD|" & adoRecordset.Fields("st").Value &_
"|TD|" & adoRecordset.Fields("postalCode").Value &_
"|TD|" & adoRecordset.Fields("c").Value &_
"|TD|" & adoRecordset.Fields("homePhone").Value &_
"|TD|" & adoRecordset.Fields("manager").Value &_
"|TD|" & adoRecordset.Fields("whenCreated").Value &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("distinguishedName").Value &_
"|TD|" & intLastLogonTime
strDetails = replace(strDetails,vbCRLF,"")
end if
else
If strDetails <> "" Then strDetails = strDetails & "|TR|"
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If InStr(LCase(adoRecordset.Fields("Info").Value), "location : ") > 0 Then
strBuilding = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), "location : ")))
strBuilding = Mid(strBuilding, 12)
Else
strBuilding = ""
End If
strDetails = strDetails & replace(strBuilding,vbCRLF,"")
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
"|TD|" & adoRecordset.Fields("TelephoneNumber").Value
If IsNull(adoRecordset.Fields("Description").Value) = False Then
strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value &_
"|TD|" & adoRecordset.Fields("Title").Value &_
"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("mail").Value
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If Left(LCase(adoRecordset.Fields("Info").Value), 15) = LCase("Machine Name : ") Then
strInfo = Trim(Mid(adoRecordset.Fields("Info").Value, 15))
'If InStr(strInfo, " ") > 0 Then strInfo = Left(strInfo, InStr(strInfo, " "))
strInfo = Replace(UCase(strInfo), UCase("Location : " & strBuilding), "")
Else
strInfo = adoRecordset.Fields("Info").Value
End If
strDetails = strDetails & "|TD|" & replace(strInfo,vbCRLF,"")
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
"|TD|" & adoRecordset.Fields("company").Value &_
"|TD|" & adoRecordset.Fields("streetAddress").Value &_
"|TD|" & adoRecordset.Fields("l").Value &_
"|TD|" & adoRecordset.Fields("st").Value &_
"|TD|" & adoRecordset.Fields("postalCode").Value &_
"|TD|" & adoRecordset.Fields("c").Value &_
"|TD|" & adoRecordset.Fields("homePhone").Value &_
"|TD|" & adoRecordset.Fields("manager").Value &_
"|TD|" & adoRecordset.Fields("whenCreated").Value &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("distinguishedName").Value &_
"|TD|" & intLastLogonTime
strDetails = replace(strDetails,vbCRLF,"")
end if
adoRecordset.MoveNext
Loop
Else
MsgBox "No records were found"
End If
' Clean up.
adoRecordset.Close
Set adoRecordset = Nothing
adoConnection.Close
If strDetails <> "" Then
arrRows = ""
arrRows = Split(strDetails, "|TR|")
If UBound(arrRows) < 0 Then
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
Else
arrData = Split(arrRows(0), "|TD|")
txt_seatno.Value = arrData(0)
txt_building.Value = arrData(1)
txt_extensionno.Value = arrData(2)
txt_empid.Value = arrData(3)
txt_department.Value = arrData(4)
txt_designation.Value = arrData(5)
txt_name.Value = arrData(6)
txt_loginname.Value = arrData(7)
txt_email.Value = arrData(8)
txt_notes.Value = arrData(9)
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
txt_oupathcomputer.value = GetOUPath(replace(arrTemp(0),"""",""))
txt_computeros.value = replace(arrTemp(1),"""","")
txt_computerservicepack.value = replace(arrTemp(2),"""","")
txt_computerdescription.value = replace(arrTemp(4),"""","")
txt_computercreated.value = replace(arrTemp(3),"""","")
else
txt_oupathcomputer.value = ""
txt_computeros.value = ""
txt_computerservicepack.value = ""
txt_computerdescription.value = ""
txt_computercreated.value = ""
end if
txt_mobileno.Value = arrData(10)
txt_company.Value = arrData(11)
txt_address.Value = arrData(12)
txt_city.Value = arrData(13)
txt_state.Value = arrData(14)
txt_zipcode.Value = arrData(15)
txt_country.Value = arrData(16)
txt_homephone.Value = arrData(17)
txt_manager.Value = arrData(18)
if txt_manager.Value <> "" then
txt_managerseen.Value = mid(txt_manager.Value,4,instr(txt_manager.Value,",")-4)
else
txt_managerseen.Value = txt_manager.Value
end if
txt_whencreated.Value = arrData(19)
txt_oupathuser.value = GetOUPath(arrData(21))
FillGroupMembershipList arrData(20),arrData(21)
span_currentrecord.InnerHTML = "1"
span_totalrecords.InnerHTML = UBound(arrRows) + 1
End If
Else
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
End If
If strDetails = "" Then
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = True
btnEMailAllRecords.Disabled = True
btnEmailAsAttachment.Disabled = True
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
ElseIf UBound(arrRows) = 0 Then
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = False
btnEMailAllRecords.Disabled = False
btnEmailAsAttachment.Disabled = False
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Visible"
btnEMailAllRecords.Style.Visibility = "Visible"
btnEmailAsAttachment.Style.Visibility = "Visible"
Else
btnFirstEvent.Disabled = False
btnPreviousEvent.Disabled = False
btnNextEvent.Disabled = False
btnLastEvent.Disabled = False
btnEmailThisRecord.Disabled = False
btnEMailAllRecords.Disabled = False
btnEmailAsAttachment.Disabled = False
btnFirstEvent.Style.Visibility = "Visible"
btnPreviousEvent.Style.Visibility = "Visible"
btnNextEvent.Style.Visibility = "Visible"
btnLastEvent.Style.Visibility = "Visible"
btnEmailThisRecord.Style.Visibility = "Visible"
btnEMailAllRecords.Style.Visibility = "Visible"
btnEmailAsAttachment.Style.Visibility = "Visible"
End If
globalStrSearchBtnPush = BtnPush
globalstrSearchField = strSearchField
if chk_qbrecorder.Checked then
AddToQueryBuilder
end if
Else
MsgBox "Please type a search request into one of the fields, then click Submit."
End If
if InStr(Join(arrFields),strCurrentField) then
execute(strCurrentField & ".focus")
execute(strCurrentField & ".select()")
end if
End Sub
Sub Get_Event
arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
txt_seatno.Value = arrData(0)
txt_building.Value = arrData(1)
txt_extensionno.Value = arrData(2)
txt_empid.Value = arrData(3)
txt_department.Value = arrData(4)
txt_designation.Value = arrData(5)
txt_name.Value = arrData(6)
txt_loginname.Value = arrData(7)
txt_email.Value = arrData(8)
txt_notes.Value = arrData(9)
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
txt_oupathcomputer.value = GetOUPath(replace(arrTemp(0),"""",""))
txt_computeros.value = replace(arrTemp(1),"""","")
txt_computerservicepack.value = replace(arrTemp(2),"""","")
txt_computerdescription.value = replace(arrTemp(4),"""","")
txt_computercreated.value = replace(arrTemp(3),"""","")
else
txt_oupathcomputer.value = ""
txt_computeros.value = ""
txt_computerservicepack.value = ""
txt_computerdescription.value = ""
txt_computercreated.value = ""
End if
txt_mobileno.Value = arrData(10)
txt_company.Value = arrData(11)
txt_address.Value = arrData(12)
txt_city.Value = arrData(13)
txt_state.Value = arrData(14)
txt_zipcode.Value = arrData(15)
txt_country.Value = arrData(16)
txt_homephone.Value = arrData(17)
txt_manager.Value = arrData(18)
if txt_manager.Value <> "" then
txt_managerseen.Value = mid(txt_manager.Value,4,instr(txt_manager.Value,",")-4)
else
txt_managerseen.Value = txt_manager.Value
end if
txt_whencreated.Value = arrData(19)
txt_oupathuser.value = GetOUPath(arrData(21))
sUserName = arrData(20)
sDistName = arrData(21)
End Sub
Sub First_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML < 1 Then
MsgBox "There are no records to display"
ElseIf span_currentrecord.InnerHTML = 1 Then
MsgBox "You are already viewing the first record."
Else
span_currentrecord.InnerHTML = 1
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Previous_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_currentrecord.InnerHTML > 1 Then
span_currentrecord.InnerHTML = span_currentrecord.InnerHTML - 1
Get_Event
FillGroupMembershipList sUserName, sDistName
ElseIf span_currentrecord.InnerHTML = 1 Then
MsgBox "You are already viewing the first record."
Else
MsgBox "There are no records to display"
End If
End If
End Sub
Sub Next_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML = 0 Then
MsgBox "There are no records for to display"
ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
MsgBox "You are already viewing the last record."
Else
span_currentrecord.InnerHTML = span_currentrecord.InnerHTML + 1
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Last_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML = 0 Then
MsgBox "There are no records to display"
ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
MsgBox "You are already viewing the last record."
Else
span_currentrecord.InnerHTML = span_totalrecords.InnerHTML
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Detect_Search_Field(strCurrentField)
arrFields = Array(_
"txt_seatno", _
"txt_building", _
"txt_extensionno", _
"txt_empid", _
"txt_department", _
"txt_designation", _
"txt_name", _
"txt_loginname", _
"txt_email", _
"txt_notes", _
"txt_replacedmachine", _
"txt_oupathcomputer", _
"txt_computeros", _
"txt_computerservicepack", _
"txt_computerdescription", _
"txt_computercreated", _
"txt_mobileno", _
"txt_company", _
"txt_address", _
"txt_city", _
"txt_state", _
"txt_zipcode", _
"txt_country", _
"txt_homephone", _
"txt_managerseen", _
"txt_whencreated", _
"txt_oupathuser" _
)
For Each strField In arrFields
If LCase(strField) <> LCase(strCurrentField) Then
Execute strField & ".style.backgroundColor=""#D3D3D3"""
Execute strField & ".Disabled = True"
End If
Next
End Sub
Sub RunScript
strAnswer = window.prompt("Please enter the path and file name to save.", "D:\HTAResults.csv")
If IsNull(strAnswer) Then
Msgbox "You clicked the Cancel button"
Else
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAnswer) = True Then
objFSO.DeleteFile strAnswer, True
'Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
Else
' do nothing
end if
Dim arrHeader()
x = 0
if chk_seatno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Seat No"""
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Building"""
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Extension"""
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Emp ID"""
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Department"""
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Designation"""
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """User Name"""
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Login Name"""
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Email Address"""
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer"""
x = x + 1
end if
if chk_oupathcomputer.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - Computer"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer OS"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Service Pack"""
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Description"""
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Account Created"""
x = x + 1
end if
if chk_mobileno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Mobile"""
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Company"""
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Address"""
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """City"""
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """State"""
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Zip Code"""
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Country"""
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Home Phone"""
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Manager"""
x = x + 1
end if
if chk_subordinates.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Subordinates"""
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Date Created"""
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - User"""
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Group Membership"""
x = x + 1
end if
strHeader = Join(arrHeader,",")
Set objFile = objFSO.CreateTextFile(strAnswer, True)
objFile.Write strHeader
Dim arrFileData()
For intRow = LBound(arrRows) To UBound(arrRows)
arrData = Split(arrRows(intRow), "|TD|")
x = 0
if chk_seatno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(0) & """"
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(1) & """"
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(2) & """"
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(3) & """"
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(4) & """"
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(5) & """"
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(6) & """"
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(7) & """"
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(8) & """"
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(9) & """"
x = x + 1
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(replace(arrTemp(0),"""","")) & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(1),"""","") & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(2),"""","") & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(4),"""","") & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(3),"""","") & """"
x = x + 1
end if
else
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
end if
if chk_mobileno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(10) & """"
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(11) & """"
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(12) & """"
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(13) & """"
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(14) & """"
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(15) & """"
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(16) & """"
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(17) & """"
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrFileData(x)
if arrData(18) <> "" then
arrFileData(x) = """" & mid(arrData(18),4,instr(arrData(18),",")-4) & """"
else
arrFileData(x) = """" & """"
end if
x = x + 1
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = ""
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & str_subordinates & """"
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(19) & """"
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(arrData(21)) & """"
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & ReportGroupMemberShipList(arrData(20),arrData(21)) & """"
x = x + 1
end if
strFileDate = Join(arrFileData,",")
objFile.Write VbCrLf & strFileDate
Next
objFile.Close
MsgBox "Saved."
End If
End Sub
Sub Email_This_Record
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
if chk_seatno.Checked then
str_seatno = "<b>Seat No: </b>" & txt_seatno.value & "<br>" & vbCRLF
else
str_seatno = ""
end if
if chk_building.Checked then
str_building = "<b>Building: </b>" & txt_building.value & "<br>" & vbCRLF
else
str_building = ""
end if
if chk_extensionno.Checked then
str_extensionno = "<b>Extension No: </b>" & txt_extensionno.value & "<br>" & vbCRLF
else
str_extensionno = ""
end if
if chk_empid.Checked then
str_empid = "<b>Emp ID: </b>" & txt_empid.value & "<br>" & vbCRLF
else
str_empid = ""
end if
if chk_department.Checked then
str_department = "<b>Department: </b>" & txt_department.value & "<br>" & vbCRLF
else
str_department = ""
end if
if chk_designation.Checked then
str_designation = "<b>Designation: </b>" & txt_designation.value & "<br>" & vbCRLF
else
str_designation = ""
end if
if chk_name.Checked then
str_name = "<b>User Name: </b>" & txt_name.value & "<br>" & vbCRLF
else
str_name = ""
end if
if chk_loginname.Checked then
str_loginname = "<b>Login Name: </b>" & txt_loginname.value & "<br>" & vbCRLF
else
str_loginname = ""
end if
if chk_email.Checked then
str_email = "<b>Email Address: </b>" & txt_email.value & "<br>" & vbCRLF
else
str_email = ""
end if
if chk_notes.Checked then
str_notes = "<b>Machine Name: </b>" & txt_notes.value & "<br>" & vbCRLF
else
str_notes = ""
end if
if chk_replacedmachine.Checked then
str_replacedmachine = "<b>Replaced Machine: </b>" & txt_replacedmachine.value & "<br>" & vbCRLF
else
str_replacedmachine = ""
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & txt_oupathcomputer.value & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & txt_computeros.value & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & txt_computerservicepack.value & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & txt_computerdescription.value & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & txt_computercreated.value & "<br>" & vbCRLF
else
str_computercreated = ""
end if
else
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & "<br>" & vbCRLF
else
str_computercreated = ""
end if
end if
if chk_mobileno.Checked then
str_mobileno = "<b>Mobile Number: </b>" & txt_mobileno.value & "<br>" & vbCRLF
else
str_mobileno = ""
end if
if chk_company.Checked then
str_company = "<b>Company: </b>" & txt_company.value & "<br>" & vbCRLF
else
str_company = ""
end if
if chk_address.Checked then
str_address = "<b>Address: </b>" & txt_address.value & "<br>" & vbCRLF
else
str_address = ""
end if
if chk_city.Checked then
str_city = "<b>City: </b>" & txt_city.value & "<br>" & vbCRLF
else
str_city = ""
end if
if chk_state.Checked then
str_state = "<b>State: </b>" & txt_state.value & "<br>" & vbCRLF
else
str_state = ""
end if
if chk_zipcode.Checked then
str_zipcode = "<b>Zip Code: </b>" & txt_zipcode.value & "<br>" & vbCRLF
else
str_zipcode = ""
end if
if chk_country.Checked then
str_country = "<b>Country: </b>" & txt_country.value & "<br>" & vbCRLF
else
str_country = ""
end if
if chk_homephone.Checked then
str_homephone = "<b>Home Phone: </b>" & txt_homephone.value & "<br>" & vbCRLF
else
str_homephone = ""
end if
if chk_manager.Checked then
if arrData(18) <> "" then
str_manager = "<b>Manager: </b>" & mid(arrData(18),4,instr(arrData(18),",")-4) & "<br>" & vbCRLF
else
str_manager = ""
end if
else
str_manager = ""
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = "<b>Subordinates: </b>"
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
str_subordinates = str_subordinates & "<br>" & vbCRLF
else
str_subordinates = ""
end if
if chk_whencreated.Checked then
str_whencreated = "<b>Date Created: </b>" & txt_whencreated.value & "<br>" & vbCRLF
else
str_whencreated = ""
end if
if chk_oupathuser.Checked then
str_oupathuser = "<b>OU Path - User: </b>" & txt_oupathuser.value & "<br>" & vbCRLF
else
str_oupathuser = ""
end if
if chk_groupmembership.Checked then
str_groupmembership = "<b>Group Membership: </b>" & ReportGroupMemberShipList(arrData(20),arrData(21)) & "<br>" & vbCRLF
else
str_groupmembership = ""
end if
str_message = str_seatno & _
str_building & _
str_extensionno & _
str_empid & _
str_department & _
str_designation & _
str_name & _
str_loginname & _
str_email & _
str_notes & _
str_replacedmachine & _
str_oupathcomputer & _
str_computeros & _
str_computerservicepack & _
str_computerdescription & _
str_computercreated & _
str_mobileno & _
str_company & _
str_address & _
str_city & _
str_state & _
str_zipcode & _
str_country & _
str_homephone & _
str_manager & _
str_subordinates & _
str_whencreated & _
str_oupathuser & _
str_groupmembership
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.HTMLBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF & str_message
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "An email has been sent"
End Sub
Sub Email_All_Records
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
str_message = ""
for n = 0 to UBound(arrRows)
arrData = Split(arrRows(n), "|TD|")
if chk_seatno.Checked then
str_seatno = "<b>Seat No: </b>" & arrData(0) & "<br>" & vbCRLF
else
str_seatno = ""
end if
if chk_building.Checked then
str_building = "<b>Building: </b>" & arrData(1) & "<br>" & vbCRLF
else
str_building = ""
end if
if chk_extensionno.Checked then
str_extensionno = "<b>Extension No: </b>" & arrData(2) & "<br>" & vbCRLF
else
str_extensionno = ""
end if
if chk_empid.Checked then
str_empid = "<b>Emp ID: </b>" & arrData(3) & "<br>" & vbCRLF
else
str_empid = ""
end if
if chk_department.Checked then
str_department = "<b>Department: </b>" & arrData(4) & "<br>" & vbCRLF
else
str_department = ""
end if
if chk_designation.Checked then
str_designation = "<b>Designation: </b>" & arrData(5) & "<br>" & vbCRLF
else
str_designation = ""
end if
if chk_name.Checked then
str_name = "<b>User Name: </b>" & arrData(6) & "<br>" & vbCRLF
else
str_name = ""
end if
if chk_loginname.Checked then
str_loginname = "<b>Login Name: </b>" & arrData(7) & "<br>" & vbCRLF
else
str_loginname = ""
end if
if chk_email.Checked then
str_email = "<b>Email Address: </b>" & arrData(8) & "<br>" & vbCRLF
else
str_email = ""
end if
if chk_notes.Checked then
str_notes = "<b>Machine Name: </b>" & arrData(9) & "<br>" & vbCRLF
else
str_notes = ""
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & GetOUPath(replace(arrTemp(0),"""","")) & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & replace(arrTemp(1),"""","") & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & replace(arrTemp(2),"""","") & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & replace(arrTemp(4),"""","") & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & replace(arrTemp(3),"""","") & "<br>" & vbCRLF
else
str_computercreated = ""
end if
else
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & "<br>" & vbCRLF
else
str_computercreated = ""
end if
end if
if chk_mobileno.Checked then
str_mobileno = "<b>Mobile Number: </b>" & arrData(10) & "<br>" & vbCRLF
else
str_mobileno = ""
end if
if chk_company.Checked then
str_company = "<b>Company: </b>" & arrData(11) & "<br>" & vbCRLF
else
str_company = ""
end if
if chk_address.Checked then
str_address = "<b>Address: </b>" & arrData(12) & "<br>" & vbCRLF
else
str_address = ""
end if
if chk_city.Checked then
str_city = "<b>City: </b>" & arrData(13) & "<br>" & vbCRLF
else
str_city = ""
end if
if chk_state.Checked then
str_state = "<b>State: </b>" & arrData(14) & "<br>" & vbCRLF
else
str_state = ""
end if
if chk_zipcode.Checked then
str_zipcode = "<b>Zip Code: </b>" & arrData(15) & "<br>" & vbCRLF
else
str_zipcode = ""
end if
if chk_country.Checked then
str_country = "<b>Country: </b>" & arrData(16) & "<br>" & vbCRLF
else
str_country = ""
end if
if chk_homephone.Checked then
str_homephone = "<b>Home Phone: </b>" & arrData(17) & "<br>" & vbCRLF
else
str_homephone = ""
end if
if chk_manager.Checked then
if arrData(18) <> "" then
str_manager = "<b>Manager: </b>" & mid(arrData(18),4,instr(arrData(18),",")-4) & "<br>" & vbCRLF
else
str_manager = ""
end if
else
str_manager = ""
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = "<b>Subordinates: </b>"
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
str_subordinates = str_subordinates & "<br>" & vbCRLF
else
str_subordinates = ""
end if
if chk_whencreated.Checked then
str_whencreated = "<b>Date Created: </b>" & arrData(19) & "<br>" & vbCRLF
else
str_whencreated = ""
end if
if chk_oupathuser.Checked then
str_oupathuser = "<b>OU Path - User: </b>" & GetOUPath(arrData(21)) & "<br>" & vbCRLF
else
str_oupathuser = ""
end if
if chk_groupmembership.Checked then
str_groupmembership = "<b>Group Membership: </b>" & ReportGroupMemberShipList(arrData(20),arrData(21)) & "<br>" & vbCRLF
else
str_groupmembership = ""
end if
str_message = str_message & _
str_seatno & _
str_building & _
str_extensionno & _
str_empid & _
str_department & _
str_designation & _
str_name & _
str_loginname & _
str_email & _
str_notes & _
str_oupathcomputer & _
str_computeros & _
str_computerservicepack & _
str_computerdescription & _
str_computercreated & _
str_mobileno & _
str_company & _
str_address & _
str_city & _
str_state & _
str_zipcode & _
str_country & _
str_homephone & _
str_manager & _
str_subordinates & _
str_whencreated & _
str_oupathuser & _
str_groupmembership & VbCrLf & "<br><hr><br><br>" & vbCRLF
next
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.HTMLBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF & str_message
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "An email has been sent"
End Sub
Sub Email_As_Attachment
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
strAnswer = fTemp & "\HTAResults.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAnswer) = True Then
objFSO.DeleteFile strAnswer, True
'Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
Else
'do nothing
end if
Dim arrHeader()
x = 0
if chk_seatno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Seat No"""
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Building"""
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Extension"""
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Emp ID"""
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Department"""
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Designation"""
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """User Name"""
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Login Name"""
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Email Address"""
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer"""
x = x + 1
end if
if chk_oupathcomputer.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - Computer"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer OS"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Service Pack"""
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Description"""
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Account Created"""
x = x + 1
end if
if chk_mobileno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Mobile"""
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Company"""
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Address"""
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """City"""
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """State"""
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Zip Code"""
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Country"""
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Home Phone"""
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Manager"""
x = x + 1
end if
if chk_subordinates.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Subordinates"""
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Date Created"""
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - User"""
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Group Membership"""
x = x + 1
end if
strHeader = Join(arrHeader,",")
Set objFile = objFSO.CreateTextFile(strAnswer, True)
objFile.Write strHeader
Dim arrFileData()
For intRow = LBound(arrRows) To UBound(arrRows)
arrData = Split(arrRows(intRow), "|TD|")
x = 0
if chk_seatno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(0) & """"
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(1) & """"
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(2) & """"
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(3) & """"
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(4) & """"
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(5) & """"
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(6) & """"
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(7) & """"
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(8) & """"
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(9) & """"
x = x + 1
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(replace(arrTemp(0),"""","")) & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(1),"""","") & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(2),"""","") & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(4),"""","") & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(3),"""","") & """"
x = x + 1
end if
else
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
end if
if chk_mobileno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(10) & """"
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(11) & """"
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(12) & """"
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(13) & """"
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(14) & """"
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(15) & """"
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(16) & """"
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(17) & """"
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrFileData(x)
if arrData(18) <> "" then
arrFileData(x) = """" & mid(arrData(18),4,instr(arrData(18),",")-4) & """"
else
arrFileData(x) = """" & """"
end if
x = x + 1
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = ""
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & str_subordinates & """"
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(19) & """"
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(arrData(21)) & """"
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & ReportGroupMemberShipList(arrData(20),arrData(21)) & """"
x = x + 1
end if
strFileDate = Join(arrFileData,",")
objFile.Write VbCrLf & strFileDate
Next
objFile.Close
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.TextBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.AddAttachment strAnswer
objMessage.Send
MsgBox "An email has been sent"
objFSO.DeleteFile strAnswer, True
End Sub
Sub SelectAllCheck
If chk_selectall.Checked then
chk_seatno.Checked = True
chk_building.Checked = True
chk_extensionno.Checked = True
chk_empid.Checked = True
chk_department.Checked = True
chk_designation.Checked = True
chk_name.Checked = True
chk_loginname.Checked = True
chk_email.Checked = True
chk_notes.Checked = True
chk_replacedmachine.Checked = True
chk_oupathcomputer.Checked = True
chk_computeros.Checked = True
chk_computerdescription.Checked = True
chk_computercreated.Checked = True
chk_mobileno.Checked = True
chk_company.Checked = True
chk_address.Checked = True
chk_city.Checked = True
chk_state.Checked = True
chk_zipcode.Checked = True
chk_country.Checked = True
chk_homephone.Checked = True
chk_manager.Checked = True
chk_whencreated.Checked = True
chk_oupathuser.Checked = True
chk_groupmembership.Checked = True
chk_subordinates.Checked = True
else
chk_seatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_seatno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
end if
End Sub
Function GetUsersEmailAddress
Set oNet = CreateObject("WScript.NetWork")
sSearchField = "(samAccountName=*" & oNet.UserName & "*)"
Set objRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = objRootDSE.Get("defaultNamingContext")
sBase = "<LDAP://" & sDNSDomain & ">"
sFilter = "(&(objectCategory=person)(objectClass=user)" & sSearchField & ")"
sAttributes = "cn,samAccountName,mail"
sQuery = sBase & ";" & sFilter & ";" & sAttributes & ";subtree"
Set aCommand = CreateObject("ADODB.Command")
Set aConnection = CreateObject("ADODB.Connection")
aConnection.Provider = "ADsDSOObject"
aConnection.Open "Active Directory Provider"
aCommand.ActiveConnection = aConnection
aCommand.CommandText = sQuery
aCommand.Properties("Page Size") = 100
aCommand.Properties("Timeout") = 30
aCommand.Properties("Cache Results") = False
Set aRecordset = aCommand.Execute
GetUsersEmailAddress = aRecordset.Fields("cn").Value
End Function
Sub ShowDialogCC
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailCC.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailCC.Value = strValidEmail
End Sub
Sub ShowDialogTo
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailTo.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailTo.Value = strValidEmail
End Sub
Sub ShowDialogFrom
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailFrom.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailFrom.Value = strValidEmail
End Sub
Sub FillGroupMembershipList(loginname,distinguishedname)
For Each objOption in lst_groupnames.Options
objOption.RemoveNode
Next
For Each objOption in lst_subordinates.Options
objOption.RemoveNode
Next
adsPath = "WinNT://" & mid(strDNSDomain,4,instr(strDNSDomain,",")-4) & "/" & loginname
Set objUser = GetObject(adsPath & ",user")
intGroupID = objUser.primaryGroupID
strFilter = "(|"
For Each Group in objUser.Groups
strFilter = strFilter & "(sAMAccountName=" & Group.name & ")"
Next
strFilter = strFilter & ")"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" _
& strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
set newOption = document.createElement("OPTION")
newOption.Text = strNTName
newOption.Value = strPrimary & ";" & strdistinguishedName
lst_groupnames.Add newOption
adoRecordset.MoveNext
Loop
strSearchField = "(manager=" & distinguishedname & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
set newOption = document.createElement("OPTION")
newOption.Text = adoRecordset.Fields("cn").Value
newOption.Value = adoRecordset.Fields("samAccountName").Value & ";" & adoRecordset.Fields("distinguishedName").Value
lst_subordinates.Add newOption
adoRecordset.MoveNext
Loop
End Sub
Function ReportGroupMembershipList(loginname,distinguishedname)
adsPath = "WinNT://" & mid(strDNSDomain,4,instr(strDNSDomain,",")-4) & "/" & loginname
Set objUser = GetObject(adsPath & ",user")
intGroupID = objUser.primaryGroupID
strFilter = "(|"
For Each Group in objUser.Groups
strFilter = strFilter & "(sAMAccountName=" & Group.name & ")"
Next
strFilter = strFilter & ")"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" _
& strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
strValue = strValue & strNTName & ";"
adoRecordset.MoveNext
Loop
strValue = mid(strValue,1,len(strValue)-1)
ReportGroupMembershipList = strValue
End Function
Function GetManagerDN(Manager)
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)(cn=*" & Manager & "*))"
strAttributes = "distinguishedName,CN"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
strresults = ""
boolResultsFound = False
Do Until adoRecordset.EOF
strDN = adoRecordset.Fields("distinguishedName").Value
sResults = sResults & "(manager=" & strDN & ")"
boolResultsFound = True
adoRecordset.MoveNext
Loop
if boolResultsFound then
sResults = "(|" & sResults & ")"
end if
GetManagerDN = sResults
End Function
Sub FillGroupList
For Each objOption in lst_groupnames.Options
objOption.RemoveNode
Next
set objRootDSE = GetObject("LDAP://RootDSE")
strBase = "<LDAP://cn=Partitions," & _
objRootDSE.Get("ConfigurationNamingContext") & ">;"
strFilter = "(&(objectcategory=crossRef)(systemFlags=3));"
strAttrs = "name,trustParent,nCName,dnsRoot,distinguishedName;"
strScope = "onelevel"
set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)
objRS.MoveFirst
set dicSubDomainTrue = CreateObject("Scripting.Dictionary")
set dicDomainHierarchy = CreateObject("Scripting.Dictionary")
set dicDomainRoot = CreateObject("Scripting.Dictionary")
while not objRS.EOF
dicDomainRoot.Add objRS.Fields("name").Value, objRS.Fields("nCName").Value
if objRS.Fields("trustParent").Value <> "" then
dicSubDomainTrue.Add objRS.Fields("name").Value, 0
set objDomainParent = GetObject("LDAP://" & objRS.Fields("trustParent").Value)
dicDomainHierarchy.Add objRS.Fields("name").Value,objDomainParent.Get("name")
else
dicSubDomainTrue.Add objRS.Fields("name").Value, 1
end if
objRS.MoveNext
wend
for each strDomain in dicSubDomainTrue
if dicSubDomainTrue(strDomain) = 1 then
PopulateGroupList strDomain
end if
next
End Sub
Sub PopulateGroupList(Domain)
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strBase = "<LDAP://" & Domain & ">"
strFilter = "(objectCategory=group)"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
set newOption = document.createElement("OPTION")
newOption.Text = strNTName
newOption.Value = strPrimary & ";" & strdistinguishedName
lst_groupnames.Add newOption
adoRecordset.MoveNext
Loop
End Sub
Sub FillSubjectList
For Each objOption in txt_EmailSubject.Options
objOption.RemoveNode
Next
For each strSubjectlineText in arrSubjectText
set newOption = document.createElement("OPTION")
newOption.Text = strSubjectlineText
newOption.Value = strSubjectlineText
txt_EmailSubject.Add newOption
Next
End Sub
Sub ConvertNamesToEmailAddresses
txt_EmailToHidden.Value = GetEmailAddresses(txt_EmailTo.Value)
txt_EmailCCHidden.Value = GetEmailAddresses(txt_EmailCC.Value)
strEmailTo = txt_EmailToHidden.Value
End Sub
Function GetEmailAddresses(names)
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(names,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("mail").Value
objRecordSet1.MoveNext
Wend
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
end if
next
GetEmailAddresses = strValidEmail
End Function
Function GetOUPath(OU)
strOU = ""
strFQDN = ""
boolFoundMatch = False
arrValues = split(OU,",")
for each strValue in arrValues
if instr(strValue,"OU=") then
strOU = strOU & replace(strValue,"OU=","") & "\"
end if
if instr(strValue,"DC=") then
strFQDN = strFQDN & replace(strValue,"DC=","") & "."
end if
if instr(strValue,"CN=") then
if boolFoundMatch then
strCN = strCN & replace(strValue,"CN=","") & "\"
else
'Skip the first match - this is always the user name
boolFoundMatch = True
end if
end if
next
if strFQDN <> "" then
strFQDN = left(strFQDN,len(strFQDN)-1)
if strOU <> "" then
strOU = left(strOU,len(strOU)-1)
else
'strOU = "{object not found in any OU}"
if strCN <> "" then
strOU = left(strCN,len(strCN)-1)
end if
end if
GetOUPath = (Split(strOU,"\")(0))
else
GetOUPath = ""
end if
End Function
Function GetComputerInfo(names)
Const adVarChar = 200
Const MaxCharacters = 255
strValidComputer = ""
strResolve = trim(names)
if strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=computer)" & _
"(cn=" & strResolve & "));cn,samAccountName,distinguishedName,operatingsystem,operatingsystemservicepack,whencreated,description;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
While Not objRecordSet1.EOF
if IsNull(objRecordSet1.Fields("distinguishedName").Value) then
sDN = ""
else
sDN = replace(objRecordSet1.Fields("distinguishedName").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("operatingsystem").Value) then
sOS = ""
else
sOS = replace(objRecordSet1.Fields("operatingsystem").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("operatingsystemservicepack").Value) then
sSP = ""
else
sSP = replace(objRecordSet1.Fields("operatingsystemservicepack").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("whencreated").Value) then
sWC = ""
else
sWC = replace(objRecordSet1.Fields("whencreated").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("description").Value) then
sDS = ""
else
'this line commented out for testing purposes - should be OK to uncomment.
'sDS = replace(objRecordSet1.Fields("description").Value,vbCRLF,"")
End if
strValidComputer = Array("""" & sDN & """","""" & sOS & """","""" & sSP & """","""" & sWC & """","""" & sDS & """")
objRecordSet1.MoveNext
Wend
end if
if isArray(strValidComputer) then
GetComputerInfo = strValidComputer
else
GetComputerInfo = ""
end if
End Function
'''''''''''''''''''
' Menu management '
'''''''''''''''''''
Sub ShowSubMenu(Parent,Child)
If Child.style.display="block" Then
Parent.classname="Menuover"
Child.style.display="none"
Set LastChildMenu=Nothing
Else
Parent.classname="Menuin"
Child.style.display="block"
Set LastChildMenu=Child
End If
Set LastMenu=Parent
End Sub
Sub MenuOver(Parent,Child)
If LastChildMenu is Nothing Then
Parent.className="MenuOver"
Else
If LastMenu is Parent Then
Parent.className="MenuIn"
Else
HideMenu
ShowSubMenu Parent,Child
End If
End If
End Sub
Sub MenuOut(Menu)
If LastChildMenu is Nothing Then Menu.className="MenuOut"
End Sub
Sub HideMenu
If Not LastChildMenu is Nothing Then
LastChildMenu.style.display="none"
Set LastChildMenu=Nothing
LastMenu.classname="Menuout"
End If
End Sub
Sub SubMenuOver(Menu)
Menu.className="SubMenuOver"
End Sub
Sub SubMenuOut(Menu)
Menu.className="SubMenuOut"
End Sub
'''''''''''''''''''
' File management '
'''''''''''''''''''
Sub SaveAs
on error resume next
Dim oDLG
Set oDLG=CreateObject("MSComDlg.CommonDialog")
if err.number > 0 then
err.clear
oDLG = window.prompt("Please enter the path and file name to save.", "C:\your-query.qry")
if oDLG <> "" then
FileName = oDLG
Save
End If
else
With oDLG
.DialogTitle = "SaveAs"
.Filter="Query|*.qry|Text Files|*.txt|All files|*.*"
.MaxFileSize = 255
.ShowSave
If .FileName <> "" Then
FileName = .FileName
Save
End If
End With
end if
Set oDLG=Nothing
DisplayTitle
End Sub
Sub Save()
Dim fso,f
If FileName <> "" Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(FileName,True)
'This is the text to get saved into the file
with f
.writeline "<root>"
.writeline "<searchfield>" & globalStrSearchField & "</searchfield>"
.writeline "<btnpush>" & globalStrSearchBtnPush & "</btnpush>"
.writeline "<to>" & txt_EmailTo.value & "</to>"
.writeline "<cc>" & txt_EmailCC.value & "</cc>"
.writeline "<bcc>" & strEmailBCC & "</bcc>"
.writeline "<subject>" & txt_EmailSubject.value & "</subject>"
.writeline "<emailbody>" & txt_EmailBody.value & "</emailbody>"
if chk_selectall.Checked then .writeline "<checkboxes>chk_selectall</checkboxes>"
if chk_seatno.Checked then .writeline "<checkboxes>chk_seatno</checkboxes>"
if chk_building.Checked then .writeline "<checkboxes>chk_building</checkboxes>"
if chk_extensionno.Checked then .writeline "<checkboxes>chk_extensionno</checkboxes>"
if chk_empid.Checked then .writeline "<checkboxes>chk_empid</checkboxes>"
if chk_department.Checked then .writeline "<checkboxes>chk_department</checkboxes>"
if chk_designation.Checked then .writeline "<checkboxes>chk_designation</checkboxes>"
if chk_name.Checked then .writeline "<checkboxes>chk_name</checkboxes>"
if chk_loginname.Checked then .writeline "<checkboxes>chk_loginname</checkboxes>"
if chk_email.Checked then .writeline "<checkboxes>chk_email</checkboxes>"
if chk_notes.Checked then .writeline "<checkboxes>chk_notes</checkboxes>"
if chk_replacedmachine.Checked then .writeline "<checkboxes>chk_replacedmachine</checkboxes>"
if chk_oupathcomputer.Checked then .writeline "<checkboxes>chk_oupathcomputer</checkboxes>"
if chk_computeros.Checked then .writeline "<checkboxes>chk_computeros</checkboxes>"
if chk_computerdescription.Checked then .writeline "<checkboxes>chk_computerdescription</checkboxes>"
if chk_computercreated.Checked then .writeline "<checkboxes>chk_computercreated</checkboxes>"
if chk_mobileno.Checked then .writeline "<checkboxes>chk_mobileno</checkboxes>"
if chk_company.Checked then .writeline "<checkboxes>chk_company</checkboxes>"
if chk_address.Checked then .writeline "<checkboxes>chk_address</checkboxes>"
if chk_city.Checked then .writeline "<checkboxes>chk_city</checkboxes>"
if chk_state.Checked then .writeline "<checkboxes>chk_state</checkboxes>"
if chk_zipcode.Checked then .writeline "<checkboxes>chk_zipcode</checkboxes>"
if chk_country.Checked then .writeline "<checkboxes>chk_country</checkboxes>"
if chk_homephone.Checked then .writeline "<checkboxes>chk_homephone</checkboxes>"
if chk_manager.Checked then .writeline "<checkboxes>chk_manager</checkboxes>"
if chk_whencreated.Checked then .writeline "<checkboxes>chk_whencreated</checkboxes>"
if chk_oupathuser.Checked then .writeline "<checkboxes>chk_oupathuser</checkboxes>"
if chk_groupmembership.Checked then .writeline "<checkboxes>chk_groupmembership</checkboxes>"
if chk_subordinates.Checked then .writeline "<checkboxes>chk_subordinates</checkboxes>"
.writeline "</root>"
.Close
end with
Set xmlDom = CreateObject("Microsoft.XMLDOM")
XmlDom.async = False
XmlDom.Load(FileName)
xmlDom.Save(FileName)
Set f = Nothing
Set fso = Nothing
Else
SaveAs
End If
End Sub
Sub OpenIt
chk_selectall.Checked = False
chk_seatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
xmlDom.load(FileName)
globalStrSearchField = xmlDom.getElementsByTagName("searchfield").item(0).text
globalStrSearchBtnPush = xmlDom.getElementsByTagName("btnpush").item(0).text
txt_EmailTo.value = xmlDom.getElementsByTagName("to").item(0).text
txt_EmailCC.value = xmlDom.getElementsByTagName("cc").item(0).text
strEmailBCC = xmlDom.getElementsByTagName("bcc").item(0).text
txt_EmailSubject.value = xmlDom.getElementsByTagName("subject").item(0).text
txt_EmailBody.value = xmlDom.getElementsByTagName("emailbody").item(0).text
for n = 0 to xmlDom.getElementsByTagName("checkboxes").Length-1
execute(xmlDom.getElementsByTagName("checkboxes").item(n).text & ".checked = True")
next
DisplayTitle
Submit_Form "FileOpen"
End Sub
Sub Open()
on error resume next
Dim oDLG
Set oDLG = CreateObject("MSComDlg.CommonDialog")
if err.number > 0 then
err.clear
oDLG = window.prompt("Please enter the path and file name to open.", "C:\your-query.qry")
if oDLG <> "" then
FileName = oDLG
OpenIt
End If
else
With oDLG
.DialogTitle = "Open"
.Filter = "Query|*.qry|Text Files|*.txt|All files|*.*"
.MaxFileSize = 255
.Flags = .Flags Or &H1000 'FileMustExist (OFN_FILEMUSTEXIST)
.ShowOpen
If .FileName <> "" Then
FileName = .FileName
OpenIt
End If
End With
end if
Set oDLG = Nothing
End Sub
Sub DisplayTitle
If FileName="" Then
document.Title="Default - " & oHTA.ApplicationName
Else
document.Title=FileName & " - " & oHTA.ApplicationName
End If
End Sub
Sub ClickTheSpecialReportButton
Submit_Form("Disabled")
End Sub
Sub SpecialReportNewUsersToday
Clear_Form
txt_whencreated.Value = FormatDateTime(Date(),2)
Detect_Search_Field("txt_whencreated")
Submit_Form("Main")
End Sub
Sub SpecialReportDisabledUsersToday
Clear_Form
txt_whencreated.Value = FormatDateTime(Date(),2)
Detect_Search_Field("txt_whencreated")
Submit_Form("DisabledToday")
End Sub
Sub GetChkProfiles
For Each objOption in lst_ChkProfiles.Options
objOption.RemoveNode
Next
strAnswer = fAppData & "\profile.xml"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If NOT objFSO.FileExists(strAnswer) Then
'Create profile.xml
Set f = objFSO.CreateTextFile(strAnswer,True)
with f
.writeline "<root>"
.writeline "<profile val=""Default"">"
.writeline "<checkboxes val=""chk_selectall"" />"
.writeline "<checkboxes val=""chk_seatno"" />"
.writeline "<checkboxes val=""chk_building"" />"
.writeline "<checkboxes val=""chk_extensionno"" />"
.writeline "<checkboxes val=""chk_empid"" />"
.writeline "<checkboxes val=""chk_department"" />"
.writeline "<checkboxes val=""chk_designation"" />"
.writeline "<checkboxes val=""chk_name"" />"
.writeline "<checkboxes val=""chk_loginname"" />"
.writeline "<checkboxes val=""chk_email"" />"
.writeline "<checkboxes val=""chk_notes"" />"
.writeline "<checkboxes val=""chk_replacedmachine"" />"
.writeline "<checkboxes val=""chk_oupathcomputer"" />"
.writeline "<checkboxes val=""chk_computeros"" />"
.writeline "<checkboxes val=""chk_computerdescription"" />"
.writeline "<checkboxes val=""chk_computercreated"" />"
.writeline "<checkboxes val=""chk_mobileno"" />"
.writeline "<checkboxes val=""chk_company"" />"
.writeline "<checkboxes val=""chk_address"" />"
.writeline "<checkboxes val=""chk_city"" />"
.writeline "<checkboxes val=""chk_state"" />"
.writeline "<checkboxes val=""chk_zipcode"" />"
.writeline "<checkboxes val=""chk_country"" />"
.writeline "<checkboxes val=""chk_homephone"" />"
.writeline "<checkboxes val=""chk_manager"" />"
.writeline "<checkboxes val=""chk_whencreated"" />"
.writeline "<checkboxes val=""chk_oupathuser"" />"
.writeline "<checkboxes val=""chk_groupmembership"" />"
.writeline "<checkboxes val=""chk_subordinates"" />"
.writeline "</profile>"
.writeline "</root>"
.Close
end with
Set xmlDom = CreateObject("Microsoft.XMLDOM")
XmlDom.async = False
XmlDom.Load(strAnswer)
xmlDom.Save(strAnswer)
End If
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
XmlDom.Load(strAnswer)
Set oNodes = XmlDom.selectNodes("//profile")
for n = 0 to oNodes.length - 1
set newOption = document.createElement("OPTION")
newOption.Text = oNodes(n).selectSingleNode("@val").Text
newOption.Value = oNodes(n).selectSingleNode("@val").Text
lst_ChkProfiles.Add newOption
next
Set f = Nothing
Set objFSO = Nothing
End Sub
Sub lst_chkprofiles_OnChange
chk_selectall.Checked = False
chk_seatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
strAnswer = fAppData & "\profile.xml"
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
XmlDom.Load(strAnswer)
Set oNodes = XmlDom.selectNodes("//profile[@val=""" & lst_chkprofiles.Value & """]/checkboxes")
For i = 0 To oNodes.length - 1
execute(oNodes(i).selectSingleNode("@val").Text & ".Checked = True")
Next
End Sub
Sub AddToCheckboxProfile
strProfileName = window.prompt("Please enter a profile name.", "My profile name")
strAnswer = fAppData & "\profile.xml"
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strAnswer, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.Readline
strLine = Trim(strLine)
If strLine <> "</root>" Then
strContents = strContents & strLine & vbCrLf
End If
Loop
objFile.Close
Set f = objFSO.OpenTextFile(strAnswer, ForWriting)
with f
.writeline strContents & vbTab & "<profile val=""" & strProfileName & """>"
if chk_selectall.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_selectall"" />"
if chk_seatno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_seatno"" />"
if chk_building.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_building"" />"
if chk_extensionno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_extensionno"" />"
if chk_empid.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_empid"" />"
if chk_department.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_department"" />"
if chk_designation.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_designation"" />"
if chk_name.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_name"" />"
if chk_loginname.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_loginname"" />"
if chk_email.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_email"" />"
if chk_notes.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_notes"" />"
if chk_replacedmachine.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_replacedmachine"" />"
if chk_oupathcomputer.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_oupathcomputer"" />"
if chk_computeros.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computeros"" />"
if chk_computerdescription.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computerdescription"" />"
if chk_computercreated.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computercreated"" />"
if chk_mobileno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_mobileno"" />"
if chk_company.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_company"" />"
if chk_address.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_address"" />"
if chk_city.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_city"" />"
if chk_state.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_state"" />"
if chk_zipcode.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_zipcode"" />"
if chk_country.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_country"" />"
if chk_homephone.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_homephone"" />"
if chk_manager.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_manager"" />"
if chk_whencreated.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_whencreated"" />"
if chk_oupathuser.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_oupathuser"" />"
if chk_groupmembership.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_groupmembership"" />"
if chk_subordinates.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_subordinates"" />"
.writeline vbTab & "</profile>"
.writeline "</root>"
.close
end with
set newOption = document.createElement("OPTION")
newOption.Text = strProfileName
newOption.Value = strProfileName
lst_ChkProfiles.Add newOption
lst_ChkProfiles.Value = strProfileName
End Sub
Sub AddToQueryBuilder
globalstrQueryBuilder = globalstrQueryBuilder & globalstrSearchField
if NOT chk_qbrecorder.Checked then
msgbox "The query has been added."
end if
End Sub
Sub QueryBuilderRecorder
if chk_qbrecorder.Checked then
msgbox "Query Builder is now recording."
else
msgbox "Query Builder has stopped recording." & vbCrLf & "Click OK to view the combined query."
RunQueryBuilder
end if
End Sub
Sub ViewQueryBuilder
if globalstrQueryBuilder <> "" then
msgbox "(|" & globalstrQueryBuilder & ")"
else
msgbox "There are no stored queries to view."
end if
End Sub
Sub RunQueryBuilder
globalStrSearchField = "(|" & globalstrQueryBuilder & ")"
globalstrSearchBtnPush = "FileOpen"
Submit_Form "FileOpen"
End Sub
Sub ClearQueryBuilder
globalstrQueryBuilder = ""
End Sub
Sub bt2Go_onclick()
'** Declarations:'
Dim OPR, DM, USR, strNTName, strUserDN, strNM, objUser, TNP, DENY, POS, NEG
Dim objNetwork, objShell
'** Objects:'
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Wscript.Shell")
'** User/Domain:'
OPR = objNetwork.UserName
DM = objNetwork.UserDomain & "\"
'** Write username for the user that needs to be enabled or disabled:'
USR = InputBox("Username:", "Enable or Disable Active Directory User", _
"Write Username Here")
if USR = "" then
exit sub
End if
'** Prevent run-time errors:'
On Error Resume Next
'** Declare NameTranslate constants:'
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
'** Combine the user name and domain name:'
strNTName = DM & USR
strNT2 = DM & OPR
'** Translate operator name into DN:'
Set objTrans2 = CreateObject("NameTranslate")
objTrans2.Init ADS_NAME_INITTYPE_GC, ""
objTrans2.Set ADS_NAME_TYPE_NT4, strNT2
strUserDN2 = objTrans2.Get(ADS_NAME_TYPE_1779)
Set objUser2 = GetObject("LDAP://" & strUserDN2)
strUS3 = Mid(strUserDN2,4)
strUS4 = Split(strUS3, ",")
For i = LBound(strUS4) to UBound(strUS4)
strNM2 = strUS4(i)
Exit For
Next
'** Translate name into DN:'
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
'** Do LDAP bind to object:'
Set objUser = GetObject("LDAP://" & strUserDN)
'** Get full name:'
strUS1 = Mid(strUserDN,4)
strUS2 = Split(strUS1, ",")
For i = LBound(strUS2) to UBound(strUS2)
strNM = strUS2(i)
Exit For
Next
'** If no error, enable or disable user:'
If Err = 0 Then
Const ADS_UF_ACCOUNTDISABLE = 2
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC XOR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
If intUAC AND ADS_UF_ACCOUNTDISABLE Then
POS = 1
Else
NEG = 1
End If
Else
objShell.Popup UCase(USR) & " was not found. Please try again.", _
5, "Unknown Username", 48
exit sub
End If
'** If no permission, give message:'
If Err = "-2147024891" Then
DENY = 1
objShell.Popup "You can not enable or disable this user.", _
5, "Permission Denied", 48
exit sub
End If
'** If no error, show result:'
If DENY <> 1 Then
If POS = 1 Then
MsgBox UCase(USR) & " were successfully enabled.", _
64, "User enabled by " & strNM2
End If
If NEG = 1 Then
MsgBox UCase(USR) & " were successfully disabled.", _
64, "User disabled by " & strNM2
End If
End If
End Sub
Sub bt1Go_onclick()
'** Declarations:'
Dim OPR, DM, USR, strNTName, strUserDN, strNM, objUser, TNP, EROR, ABS
Dim objNetwork, objShell, objFSO
'** Objects:'
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'** User/Domain:'
OPR = objNetwork.UserName
DM = objNetwork.UserDomain & "\"
'** Type username for the user that needs password change:'
USR = InputBox("Username:", "Create Temporary Active Directory User Password", _
"Write Username Here")
if USR = "" then
exit sub
End if
'** Prevent run-time errors:'
On Error Resume Next
'** NameTranslate constants:'
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
'** Combine the user name and domain name:'
strNTName = DM & USR
strNT2 = DM & OPR
'** Translate operator name into DN:'
Set objTrans2 = CreateObject("NameTranslate")
objTrans2.Init ADS_NAME_INITTYPE_GC, ""
objTrans2.Set ADS_NAME_TYPE_NT4, strNT2
strUserDN2 = objTrans2.Get(ADS_NAME_TYPE_1779)
Set objUser2 = GetObject("LDAP://" & strUserDN2)
strUS3 = Mid(strUserDN2,4)
strUS4 = Split(strUS3, ",")
For i = LBound(strUS4) to UBound(strUS4)
strNM2 = strUS4(i)
Exit For
Next
'** Translate username into DN:'
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
If Err <> 0 Then
ABS = 1
End If
'** Execute if object is found:'
If ABS <> 1 Then
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
'** Do LDAP bind to object:'
Set objUser = GetObject("LDAP://" & strUserDN)
'** Get full name:'
strUS1 = Mid(strUserDN,4)
strUS2 = Split(strUS1, ",")
For i = LBound(strUS2) to UBound(strUS2)
strNM = strUS2(i)
Exit For
Next
'** Assign password and parameters:'
If strNM <> "" Then
TNP = "changeme" & Mid(objFSO.GetTempName,4,4)
objUser.SetPassword TNP
If Err <> 0 Then
EROR = 1
End If
objUser.Put "pwdLastSet", 0
objUser.IsAccountLocked = False
objUser.SetInfo
End If
'** If no error, show new temporary password:'
If EROR <> 1 Then
MsgBox "New temporary password for " & UCase(USR) & " (" & strNM & "):" & _
vbCrLf & vbCrLf & TNP & vbCrLf, 64, "New Password, configured by " & strNM2
End If
End If
'** End if object not found:'
If ABS = 1 Then
MsgBox UCase(USR) & " was not found. Please try again.", _
48, "Unknown Username"
End If
'** If no permission, give message:'
If EROR = 1 Then
MsgBox "You can not change password for this user.", _
48, "Permission Denied"
End If
End Sub
</script>
<STYLE TYPE="text/css">
<!--
body {background-color: menu;color: menutext;}
td {font-family: MS Sans Serif;font-size: 8pt;}
input {font-family: MS Sans Serif;font-size: 8pt;}
button {font-family: MS Sans Serif;font-size: 8pt;}
option {font-family: MS Sans Serif;font-size: 8pt;}
select {font-family: MS Sans Serif;font-size: 8pt;}
.submenu {position:absolute;top=35;
background-color:Menu;
border="1px outset";}
.MenuIn {border:"1px inset";cursor:default;}
.Menuover {border:"1px outset";cursor:default;}
.Menuout {}
.Submenuover {background-color:highlight;color:highlighttext;cursor:default;}
.Submenuout {background-color:Menu;color:MenuText;cursor:default;}
-->
</STYLE>
<body>
<TABLE id=MenuTable height=25><TR>
<TD onclick='ShowSubMenu Me,MyFileMenu'
onmouseover='MenuOver Me,MyFileMenu'
onmouseout='MenuOut Me'> Query </TD>
<TD >|</TD>
<TD onclick='ShowSubMenu Me,MyEditMenu'
onmouseover='MenuOver Me,MyEditMenu'
onmouseout='MenuOut Me'> Reports </TD>
<TD >|</TD>
<TD onclick='ShowSubMenu Me,QueryBuilderMenu'
onmouseover='MenuOver Me,QueryBuilderMenu'
onmouseout='MenuOut Me'> Query Builder </TD>
<TD >|</TD>
<TD > Checkbox Profile <select id="lst_chkprofiles" name="lst_chkprofiles">
</select>
</TD>
<TD onclick='AddToCheckboxProfile'
onmouseover='MenuOver Me,MyFileMenu'
onmouseout='MenuOut Me'> Add current settings to profile</TD>
<TD >|</TD>
<TD onclick="HideMenu" width="100%" border="2"></TD>
</TR></TABLE>
<TABLE ID=MyFileMenu class=submenu style="left=10;display:none;">
<TR><TD onclick="HideMenu:open"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Open</TD></TR>
<TR><TD onclick="HideMenu:save"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save</TD></TR>
<TR><TD onclick="HideMenu:saveAs"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save As</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:window.close"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Quit</TD></TR>
</TABLE>
<TABLE ID=MyEditMenu class=submenu style="left=50;display:none;">
<TR><TD onclick="HideMenu:Email_This_Record"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email This Record</TD></TR>
<TR><TD onclick="HideMenu:Email_All_Records"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email All Records</TD></TR>
<TR><TD onclick="HideMenu:Email_As_Attachment"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email as Attachment</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:RunScript"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save to</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:ClickTheSpecialReportButton"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> All Disabled Users</TD></TR>
<TR><TD onclick="HideMenu:SpecialReportDisabledUsersToday"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Disabled Users Modified Today</TD></TR>
<TR><TD onclick="HideMenu:SpecialReportNewUsersToday"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> New Users Created Today</TD></TR>
</TABLE>
<TABLE ID=QueryBuilderMenu class=submenu style="left=95;display:none;">
<TR><TD onclick="HideMenu:AddToQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Add recent query to Query Builder</TD></TR>
<TR><TD onclick="HideMenu:QueryBuilderRecorder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Query Builder Recorder<input type="checkbox" id="chk_qbrecorder" name="chk_qbrecorder"></TD></TR>
<TR><TD onclick="HideMenu:ViewQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> View Query Builder</TD></TR>
<TR><TD onclick="HideMenu:RunQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Run Query Builder</TD></TR>
<TR><TD onclick="HideMenu:ClearQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Clear Query Builder</TD></TR>
</TABLE>
<hr>
<!-- <table><tr><td align="right"><img src="G:\Tools\oemlogo.bmp"></td></tr></table> -->
<table width="100%" border="0" onclick="HideMenu">
<tr>
<td align="left" colspan="2" valign="top">
<table border="0" padding="1">
<tr>
<td>
<fieldset>
<LEGEND>Email Settings</LEGEND>
<table border="0">
<tr><td>To:</td><td><button onclick="ShowDialogTo">Resolve</button></td><td><input type="text" id="txt_EmailTo" name="txt_EmailTo" size="50"><input type="hidden" id="txt_EmailToHidden" name="txt_EmailToHidden" size="50"><br></td></td><td rowspan="4" valign="top">Email Body:</td><td rowspan="3" valign="top"><textarea id="txt_EmailBody" name="txt_EmailBody" rows=5 cols=40></TEXTAREA></td></tr>
<tr><td>CC:</td><td><button onclick="ShowDialogCC">Resolve</button></td><td><input type="text" id="txt_EmailCC" name="txt_EmailCC" size="50"><input type="hidden" id="txt_EmailCCHidden" name="txt_EmailCCHidden" size="50"><br></td></tr>
<tr><td>Email Subject:</td><td></td><td><select id="txt_EmailSubject" name="txt_EmailSubject"></select></td></tr>
</table>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top">
<table border="0">
<tr>
<td>
</td>
<td>
<input type="checkbox" id="chk_selectall" name="chk_selectall" checked=True onclick="vbs:SelectAllCheck">Select/Deselect All
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="checkbox" id="chk_seatno" name="chk_seatno" checked=True><input type="text" size="40" id="txt_seatno" name="txt_seatno" onkeypress="vbs:Detect_Search_Field('txt_seatno')">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<input type="checkbox" id="chk_building" name="chk_building" checked=True><input type="text" size="40" id="txt_building" name="txt_building" onkeypress="vbs:Detect_Search_Field('txt_building')">
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="checkbox" id="chk_extensionno" name="chk_extensionno" checked=True><input type="text" size="40" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Detect_Search_Field('txt_extensionno')">
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="checkbox" id="chk_empid" name="chk_empid" checked=True><input type="text" size="10" id="txt_empid" name="txt_empid" onkeypress="vbs:Detect_Search_Field('txt_empid')">
</td>
</tr>
<tr>
<td>
Department:
</td>
<td>
<input type="checkbox" id="chk_department" name="chk_department" checked=True><input type="text" size="50" id="txt_department" name="txt_department" onkeypress="vbs:Detect_Search_Field('txt_department')">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="checkbox" id="chk_designation" name="chk_designation" checked=True><input type="text" size="50" id="txt_designation" name="txt_designation" onkeypress="vbs:Detect_Search_Field('txt_designation')">
</td>
</tr>
<tr>
<td>
User Name:
</td>
<td>
<input type="checkbox" id="chk_name" name="chk_name" checked=True><input type="text" size="40" id="txt_name" name="txt_name" onkeypress="vbs:Detect_Search_Field('txt_name')">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="checkbox" id="chk_loginname" name="chk_loginname" checked=True><input type="text" size="40" id="txt_loginname" name="txt_loginname" onkeypress="vbs:Detect_Search_Field('txt_loginname')">
</td>
</tr>
<tr>
<td>
Email Address:
</td>
<td>
<input type="checkbox" id="chk_email" name="chk_email" checked=True><input type="text" size="50" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
</td>
</tr>
<tr>
<td>
Mobile Number:
</td>
<td>
<input type="checkbox" id="chk_mobileno" name="chk_mobileno" checked=True><input type="text" size="20" id="txt_mobileno" name="txt_mobileno" onkeypress="vbs:Detect_Search_Field('txt_mobileno')">
</td>
</tr>
<tr>
<td>
Company:
</td>
<td>
<input type="checkbox" id="chk_company" name="chk_company" checked=True><input type="text" size="20" id="txt_company" name="txt_company" onkeypress="vbs:Detect_Search_Field('txt_company')">
</td>
</tr>
<tr>
<td>
Address:
</td>
<td>
<input type="checkbox" id="chk_address" name="chk_address" checked=True><input type="text" size="20" id="txt_address" name="txt_address" onkeypress="vbs:Detect_Search_Field('txt_address')">
</td>
</tr>
<tr>
<td>
City:
</td>
<td>
<input type="checkbox" id="chk_city" name="chk_city" checked=True><input type="text" size="20" id="txt_city" name="txt_city" onkeypress="vbs:Detect_Search_Field('txt_city')">
</td>
</tr>
<tr>
<td>
State:
</td>
<td>
<input type="checkbox" id="chk_state" name="chk_state" checked=True><input type="text" size="20" id="txt_state" name="txt_state" onkeypress="vbs:Detect_Search_Field('txt_state')">
</td>
</tr>
<tr>
<td>
Zip Code:
</td>
<td>
<input type="checkbox" id="chk_zipcode" name="chk_zipcode" checked=True><input type="text" size="20" id="txt_zipcode" name="txt_zipcode" onkeypress="vbs:Detect_Search_Field('txt_zipcode')">
</td>
</tr>
<tr>
<td>
Country:
</td>
<td>
<input type="checkbox" id="chk_country" name="chk_country" checked=True><input type="text" size="20" id="txt_country" name="txt_country" onkeypress="vbs:Detect_Search_Field('txt_country')">
  Must search by 2 letter country code
</td>
</tr>
<tr>
<td>
Home Phone:
</td>
<td>
<input type="checkbox" id="chk_homephoneo" name="chk_homephone" checked=True><input type="text" size="20" id="txt_homephone" name="txt_homephone" onkeypress="vbs:Detect_Search_Field('txt_homephone')">
</td>
</tr>
<tr>
<td>
Manager:
</td>
<td>
<input type="checkbox" id="chk_manager" name="chk_manager" checked=True><input type="hidden" size="20" id="txt_manager" name="txt_manager"><input type="text" size="20" id="txt_managerseen" name="txt_managerseen" onkeypress="vbs:Detect_Search_Field('txt_managerseen')">
</td>
</tr>
<tr>
<td>
Date Created:
</td>
<td>
<input type="checkbox" id="chk_whencreated" name="chk_whencreated" checked=True><input type="text" size="40" id="txt_whencreated" name="txt_whencreated" onkeypress="vbs:Detect_Search_Field('txt_whencreated')">
</td>
</tr>
<tr>
<td>
OU Path:
</td>
<td>
<input type="checkbox" id="chk_oupathuser" name="chk_oupathuser" checked=True><input type="text" size="50" id="txt_oupathuser" name="txt_oupathuser" onkeypress="vbs:Detect_Search_Field('txt_oupathuser')">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br>Showing record 
<span id="span_currentrecord">
0
</span>
 of 
<span id="span_totalrecords">
0
</span>
<br>
<input type="button" value='||< First' name='btnFirstEvent' onClick='vbs:First_Event'>     
<input type="button" value='<< Previous' name='btnPreviousEvent' onClick='vbs:Previous_Event'>     
<input type="button" value='Next >>' name='btnNextEvent' onClick='vbs:Next_Event'>     
<input type="button" value='Last >||' name='btnLastEvent' onClick='vbs:Last_Event'><br><br><br>
<input type="button" value='Email this record' name='btnEmailThisRecord' onClick='vbs:Email_This_Record'>     
<input type="button" value='Email all records' name='btnEmailAllRecords' onClick='vbs:Email_All_Records'>     
<input type="button" value='Email as attachment' name='btnEmailAsAttachment' onClick='vbs:Email_As_Attachment'><br><br><br>
<input type="button" value='Clear Form' name='btnClearForm' onClick='vbs:Clear_Form'>
<input type="submit" value="Submit" name="btn_submit" onClick="vbs:Submit_Form('Main')">
<input id="runbutton" class="button" type="button" value="Save to" name="run_button" onClick="Runscript">
<input id="runbutton" class="button" type="button" value="Change User Password" name="bt1go">
<input id="runbutton" class="button" type="button" value="Enable or Disable User" name="bt2go">
</td>
</tr>
</table>
</td>
<td align="left" valign="top">
<fieldset>
<LEGEND><input type="checkbox" id="chk_groupmembership" name="chk_groupmembership" checked=True>Group Membership</LEGEND>
<select size="12" id="lst_groupnames" name="lst_groupnames" onDblClick="vbs:Submit_Form('Group')">
</select>
</fieldset>
<br><br>
<fieldset>
<LEGEND><input type="checkbox" id="chk_subordinates" name="chk_subordinates" checked=True>Subordinates</LEGEND>
<select size="12" id="lst_subordinates" name="lst_subordinates" onDblClick="vbs:Submit_Form('Subordinate')">
</select>
</fieldset>
<br><br>
<fieldset>
<LEGEND>Computer Information</LEGEND>
<table>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="checkbox" id="chk_notes" name="chk_notes" checked=True><input type="text" size="40" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
</td>
</tr>
<tr>
<td>
Replaced Machine:
</td>
<td>
<input type="checkbox" id="chk_replacedmachine" name="chk_replacedmachine" checked=True><input type="text" size="40" id="txt_replacedmachine" name="txt_replacedmachine" onkeypress="vbs:Detect_Search_Field('txt_replacedmachine')">
</td>
</tr>
<tr>
<td>
OU Path:
</td>
<td>
<input type="checkbox" id="chk_oupathcomputer" name="chk_oupathcomputer" checked=True><input type="text" size="40" id="txt_oupathcomputer" name="txt_oupathcomputer" onkeypress="vbs:Detect_Search_Field('txt_oupathcomputer')">
</td>
</tr>
<tr>
<td>
Computer OS:
</td>
<td>
<input type="checkbox" id="chk_computeros" name="chk_computeros" checked=True><input type="text" size="19" id="txt_computeros" name="txt_computeros" onkeypress="vbs:Detect_Search_Field('txt_computeros')">
<input type="text" size="18" id="txt_computerservicepack" name="txt_computerservicepack" onkeypress="vbs:Detect_Search_Field('txt_computerservicepack')">
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<input type="checkbox" id="chk_computerdescription" name="chk_computerdescription" checked=True><input type="text" size="40" id="txt_computerdescription" name="txt_computerdescription" onkeypress="vbs:Detect_Search_Field('txt_computerdescription')">
</td>
</tr>
<tr>
<td>
Created:
</td>
<td>
<input type="checkbox" id="chk_computercreated" name="chk_computercreated" checked=True><input type="text" size="40" id="txt_computercreated" name="txt_computercreated" onkeypress="vbs:Detect_Search_Field('txt_computercreated')">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</body>
1.Need a box below seat no same as the Replace machine box New Seat NO
>> I need 4 boxes total as
Machine Name (From Notes)
Serial No (From Notes) I have a new option added in notes that has the serial no of the machine. Can i get to this box "Header in there is "Serial No :"
Replaced Machine Name (Static will be entered manually if required just for mailing purpose)
Serial No (Static will be entered manually if required just for mailing purpose)
Done but will require your testing and feedback. I had to guess a little at how the text is formatted so let me know what happens.
2.Need to comment the Address,City,State,Zip code,Country,Home phone no So these boxes are not visible and have no action in the Hta.When required I can un comment these in the code. Need some headers so can recognize them.
Done. Look in Sub Window_OnLoad around line 58.
'Uncomment the following lines to hide them from the GUI
'tr_seatno.classname="Hide FromGUI"
'tr_replacementseatno.clas sname="Hid eFromGUI"
'tr_building.classname="Hi deFromGUI"
'tr_extensionno.classname= "HideFromG UI"
'tr_empid.classname="HideF romGUI"
'tr_department.classname=" HideFromGU I"
'tr_designation.classname= "HideFromG UI"
'tr_name.classname="HideFr omGUI"
'tr_loginname.classname="H ideFromGUI "
'tr_email.classname="HideF romGUI"
'tr_mobileno.classname="Hi deFromGUI"
'tr_company.classname="Hid eFromGUI"
tr_address.classname="Hide FromGUI"
tr_city.classname="HideFro mGUI"
tr_state.classname="HideFr omGUI"
tr_zipcode.classname="Hide FromGUI"
tr_country.classname="Hide FromGUI"
tr_homephone.classname="Hi deFromGUI"
'tr_manager.classname="Hid eFromGUI"
'tr_whencreated.classname= "HideFromG UI"
'tr_oupathuser.classname=" HideFromGU I"
3.When type a name in the group membership or subordinates it has to go to the particular data.
Done but there is a GUI limitation.
Group list should now appear in alphabetical order (possibly per domain?). The list box control is limited in how it can get you to a name it will only match to the first letter of the list item.
4.When typed the replacement machine data all the fields become disabled for editing. Can it be open for me to enter more data on the particular field
Done.
5.Computer Description (Pending)
Not done.
6.When selected a subject or a profile the pre set email id s have to be resolved to the To & CC (Pending)
Not done.
7.Can we have 2 boxes 1 for Distribution and 1 for security group s .This would be so useful to take report of them.
Not done.
8.Can we have 2 boxes 1 for local groups & another for root group s (for 7 & 8) I don t mind if I need to scroll to the right because of space constrain. These 2 options would be useful to differentiate and add/remove groups later on.
Not done.
9.Root Domain Groups when querying a user (pending)
Not done.
10. Import from Excel (Pending)
Not done.
11.Once opened the Hta be able to export Save to all groups be saved to the Csv
Done.
>> I need 4 boxes total as
Machine Name (From Notes)
Serial No (From Notes) I have a new option added in notes that has the serial no of the machine. Can i get to this box "Header in there is "Serial No :"
Replaced Machine Name (Static will be entered manually if required just for mailing purpose)
Serial No (Static will be entered manually if required just for mailing purpose)
Done but will require your testing and feedback. I had to guess a little at how the text is formatted so let me know what happens.
2.Need to comment the Address,City,State,Zip code,Country,Home phone no So these boxes are not visible and have no action in the Hta.When required I can un comment these in the code. Need some headers so can recognize them.
Done. Look in Sub Window_OnLoad around line 58.
'Uncomment the following lines to hide them from the GUI
'tr_seatno.classname="Hide
'tr_replacementseatno.clas
'tr_building.classname="Hi
'tr_extensionno.classname=
'tr_empid.classname="HideF
'tr_department.classname="
'tr_designation.classname=
'tr_name.classname="HideFr
'tr_loginname.classname="H
'tr_email.classname="HideF
'tr_mobileno.classname="Hi
'tr_company.classname="Hid
tr_address.classname="Hide
tr_city.classname="HideFro
tr_state.classname="HideFr
tr_zipcode.classname="Hide
tr_country.classname="Hide
tr_homephone.classname="Hi
'tr_manager.classname="Hid
'tr_whencreated.classname=
'tr_oupathuser.classname="
3.When type a name in the group membership or subordinates it has to go to the particular data.
Done but there is a GUI limitation.
Group list should now appear in alphabetical order (possibly per domain?). The list box control is limited in how it can get you to a name it will only match to the first letter of the list item.
4.When typed the replacement machine data all the fields become disabled for editing. Can it be open for me to enter more data on the particular field
Done.
5.Computer Description (Pending)
Not done.
6.When selected a subject or a profile the pre set email id s have to be resolved to the To & CC (Pending)
Not done.
7.Can we have 2 boxes 1 for Distribution and 1 for security group s .This would be so useful to take report of them.
Not done.
8.Can we have 2 boxes 1 for local groups & another for root group s (for 7 & 8) I don t mind if I need to scroll to the right because of space constrain. These 2 options would be useful to differentiate and add/remove groups later on.
Not done.
9.Root Domain Groups when querying a user (pending)
Not done.
10. Import from Excel (Pending)
Not done.
11.Once opened the Hta be able to export Save to all groups be saved to the Csv
Done.
<head>
<title>User Information</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information"
BORDER="thin"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="MAXIMIZE"
ID="oHTA"
>
</head>
<script language="VBScript">
Const adVarChar = 200
Const VarCharMaxCharacters = 255
Dim strEmailBCC
Dim strEmailServer
Dim arrSubjectText
strEmailBCC = "" 'Enter the BCC field as "Your Name <youremail@yourdomain.com>"
strEmailServer = "MAILSERVER" 'Exchange server name
arrSubjectText = array("This is subject text #1","This is subject text #2","This is subject text #3","This is subject text #4")
strEmailFrom = "" 'Leave Blank if the HTA should determine email address automatically
Dim arrRows
Dim strEmailFrom
Dim strEmailTo
Dim strEmailCC
Dim DataList
Dim sUserName
Dim sDistName
Dim strDNSDomain
Dim globalstrSearchField
Dim globalstrSearchBtnPush
Dim FileName
Dim fModif
Dim LastChildMenu
Dim LastMenu
Dim globalstrQueryBuilder
If strEmailFrom = "" Then
strEmailFrom = mid(GetEmailAddresses(GetUsersEmailAddress),1,len(GetEmailAddresses(GetUsersEmailAddress))-1)
strEmailFrom = GetUsersEmailAddress & " <" & strEmailFrom & ">" 'Getting email address from logged on user
End if
strEmailTo = GetUsersEmailAddress 'Get user name of logged on user so there is a default value when launched
strEmailCC = ""
DisplayTitle
Set LastChildMenu = Nothing
Set LastMenu = Nothing
Set oShell = CreateObject("WScript.Shell")
fTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
fAppData = oShell.ExpandEnvironmentStrings("%APPDATA%")
Sub Window_OnLoad
'Uncomment the following lines to hide them from the GUI
'tr_seatno.classname="HideFromGUI"
'tr_replacementseatno.classname="HideFromGUI"
'tr_building.classname="HideFromGUI"
'tr_extensionno.classname="HideFromGUI"
'tr_empid.classname="HideFromGUI"
'tr_department.classname="HideFromGUI"
'tr_designation.classname="HideFromGUI"
'tr_name.classname="HideFromGUI"
'tr_loginname.classname="HideFromGUI"
'tr_email.classname="HideFromGUI"
'tr_mobileno.classname="HideFromGUI"
'tr_company.classname="HideFromGUI"
tr_address.classname="HideFromGUI"
tr_city.classname="HideFromGUI"
tr_state.classname="HideFromGUI"
tr_zipcode.classname="HideFromGUI"
tr_country.classname="HideFromGUI"
tr_homephone.classname="HideFromGUI"
'tr_manager.classname="HideFromGUI"
'tr_whencreated.classname="HideFromGUI"
'tr_oupathuser.classname="HideFromGUI"
'Test to see what lines are hidden and uncheck the boxes
if tr_seatno.classname="HideFromGUI" then chk_seatno.Checked = False
if tr_replacementseatno.classname="HideFromGUI" then chk_replacementseatno.Checked = False
if tr_building.classname="HideFromGUI" then chk_building.Checked = False
if tr_extensionno.classname="HideFromGUI" then chk_extensionno.Checked = False
if tr_empid.classname="HideFromGUI" then chk_empid.Checked = False
if tr_department.classname="HideFromGUI" then chk_department.Checked = False
if tr_designation.classname="HideFromGUI" then chk_designation.Checked = False
if tr_name.classname="HideFromGUI" then chk_name.Checked = False
if tr_loginname.classname="HideFromGUI" then chk_loginname.Checked = False
if tr_email.classname="HideFromGUI" then chk_email.Checked = False
if tr_mobileno.classname="HideFromGUI" then chk_mobileno.Checked = False
if tr_company.classname="HideFromGUI" then chk_company.Checked = False
if tr_address.classname="HideFromGUI" then chk_address.Checked = False
if tr_city.classname="HideFromGUI" then chk_city.Checked = False
if tr_state.classname="HideFromGUI" then chk_state.Checked = False
if tr_zipcode.classname="HideFromGUI" then chk_zipcode.Checked = False
if tr_country.classname="HideFromGUI" then chk_country.Checked = False
if tr_homephone.classname="HideFromGUI" then chk_homephone.Checked = False
if tr_manager.classname="HideFromGUI" then chk_manager.Checked = False
if tr_whencreated.classname="HideFromGUI" then chk_whencreated.Checked = False
if tr_oupathuser.classname="HideFromGUI" then chk_oupathuser.Checked = False
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = True
btnEMailAllRecords.Disabled = True
btnEmailAsAttachment.Disabled = True
txt_EmailTo.Value = strEmailTo
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
FillGroupList
FillSubjectList
GetChkProfiles
End Sub
Sub Clear_Form
txt_seatno.Value = ""
txt_seatno.style.backgroundColor="#FFFFFF"
txt_seatno.Disabled = False
txt_replacementseatno.Value = ""
txt_replacementseatno.style.backgroundColor="#FFFFFF"
txt_replacementseatno.Disabled = False
txt_building.Value = ""
txt_building.style.backgroundColor="#FFFFFF"
txt_building.Disabled = False
txt_extensionno.Value = ""
txt_extensionno.style.backgroundColor="#FFFFFF"
txt_extensionno.Disabled = False
txt_empid.Value = ""
txt_empid.style.backgroundColor="#FFFFFF"
txt_empid.Disabled = False
txt_department.Value = ""
txt_department.style.backgroundColor="#FFFFFF"
txt_department.Disabled = False
txt_designation.Value = ""
txt_designation.style.backgroundColor="#FFFFFF"
txt_designation.Disabled = False
txt_name.Value = ""
txt_name.style.backgroundColor="#FFFFFF"
txt_name.Disabled = False
txt_loginname.Value = ""
txt_loginname.style.backgroundColor="#FFFFFF"
txt_loginname.Disabled = False
txt_email.Value = ""
txt_email.style.backgroundColor="#FFFFFF"
txt_email.Disabled = False
txt_notes.Value = ""
txt_notes.style.backgroundColor="#FFFFFF"
txt_notes.Disabled = False
txt_computerserialno.Value = ""
txt_computerserialno.style.backgroundColor="#FFFFFF"
txt_computerserialno.Disabled = False
txt_replacedmachine.Value = ""
txt_replacedmachine.Disabled = False
txt_replacedmachine.style.backgroundcolor="#FFFFFF"
txt_oupathcomputer.Value = ""
txt_oupathcomputer.style.backgroundColor="#FFFFFF"
txt_oupathcomputer.Disabled = False
txt_computeros.Value = ""
txt_computeros.Style.backgroundColor="#FFFFFF"
txt_computeros.Disabled = False
txt_computerservicepack.Value = ""
txt_computerservicepack.Style.backgroundColor="#FFFFFF"
txt_computerservicepack.Disabled = False
txt_computercreated.Value = ""
txt_computercreated.Style.backgroundColor="#FFFFFF"
txt_computercreated.Disabled = False
txt_computerdescription.Value = ""
txt_computerdescription.Style.backgroundColor="#FFFFFF"
txt_computerdescription.Disabled = False
txt_mobileno.Value = ""
txt_mobileno.style.backgroundColor="#FFFFFF"
txt_mobileno.Disabled = False
txt_company.Value = ""
txt_company.style.backgroundColor="#FFFFFF"
txt_company.Disabled = False
txt_address.Value = ""
txt_address.style.backgroundColor="#FFFFFF"
txt_address.Disabled = False
txt_city.Value = ""
txt_city.style.backgroundColor="#FFFFFF"
txt_city.Disabled = False
txt_state.Value = ""
txt_state.style.backgroundColor="#FFFFFF"
txt_state.Disabled = False
txt_zipcode.Value = ""
txt_zipcode.style.backgroundColor="#FFFFFF"
txt_zipcode.Disabled = False
txt_country.Value = ""
txt_country.style.backgroundColor="#FFFFFF"
txt_country.Disabled = False
txt_homephone.Value = ""
txt_homephone.style.backgroundColor="#FFFFFF"
txt_homephone.Disabled = False
txt_manager.Value = ""
txt_manager.style.backgroundColor="#FFFFFF"
txt_manager.Disabled = False
txt_managerseen.Value = ""
txt_managerseen.style.backgroundColor="#FFFFFF"
txt_managerseen.Disabled = False
txt_whencreated.Value = ""
txt_whencreated.style.backgroundColor="#FFFFFF"
txt_whencreated.Disabled = False
txt_oupathuser.Value = ""
txt_oupathuser.style.backgroundColor="#FFFFFF"
txt_oupathuser.Disabled = False
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
End Sub
Sub Submit_Form(btnPush)
arrFields = Array(_
"txt_seatno", _
"txt_building", _
"txt_extensionno", _
"txt_empid", _
"txt_department", _
"txt_designation", _
"txt_name", _
"txt_loginname", _
"txt_email", _
"txt_notes", _
"txt_mobileno", _
"txt_company", _
"txt_address", _
"txt_city", _
"txt_state", _
"txt_zipcode", _
"txt_country", _
"txt_homephone", _
"txt_managerseen", _
"txt_whencreated" _
)
boolValid = False
For Each strField In arrFields
If Eval(strField & ".Disabled") = True Then
boolValid = True
End If
If Eval(strField & ".Disabled") = False Then
strCurrentField = strField
End If
Next
If boolValid = False Then strCurrentField = "INVALID"
Select Case strCurrentField
Case "txt_seatno"
If txt_seatno.Value = "" Then
strSearchField = "(info=*)"
Else
strSearchField = "(info=*" & txt_seatno.Value & "*)"
End If
Case "txt_building"
If txt_building.Value = "" Then
strSearchField = "(physicalDeliveryOfficeName=*)"
Else
strSearchField = "(physicalDeliveryOfficeName=*" & txt_building.Value & "*)"
End If
Case "txt_extensionno"
If txt_extensionno.Value = "" Then
strSearchField = "(telephoneNumber=*)"
Else
strSearchField = "(telephoneNumber=*" & txt_extensionno.Value & "*)"
End If
Case "txt_empid"
If txt_empid.Value = "" Then
strSearchField = "(description=*)"
Else
strSearchField = "(description=*" & txt_empid.Value & "*)"
End If
Case "txt_department"
If txt_department.Value = "" Then
strSearchField = "(department=*)"
Else
strSearchField = "(department=*" & txt_department.Value & "*)"
End If
Case "txt_designation"
If txt_designation.Value = "" Then
strSearchField = "(title=*)"
Else
strSearchField = "(title=*" & txt_designation.Value & "*)"
End If
Case "txt_name"
If txt_name.Value = "" Then
strSearchField = "(cn=*)"
Else
strSearchField = "(cn=*" & txt_name.Value & "*)"
End If
Case "txt_loginname"
If txt_loginname.Value = "" Then
strSearchField = "(samAccountName=*)"
Else
strSearchField = "(samAccountName=*" & txt_loginname.Value & "*)"
End If
Case "txt_email"
If txt_email.Value = "" Then
strSearchField = "(mail=*)"
Else
strSearchField = "(mail=*" & txt_email.Value & "*)"
End If
Case "txt_notes"
If txt_notes.Value = "" Then
strSearchField = "(info=*)"
Else
strSearchField = "(info=*" & txt_notes.Value & "*)"
End If
Case "txt_mobileno"
If txt_mobileno.Value = "" Then
strSearchField = "(mobile=*)"
Else
strSearchField = "(mobile=*" & txt_mobileno.Value & "*)"
End If
Case "txt_company"
If txt_company.Value = "" Then
strSearchField = "(company=*)"
Else
strSearchField = "(company=*" & txt_company.Value & "*)"
End If
Case "txt_address"
If txt_address.Value = "" Then
strSearchField = "(streetAddress=*)"
Else
strSearchField = "(streetAddress=*" & txt_address.Value & "*)"
End If
Case "txt_city"
If txt_city.Value = "" Then
strSearchField = "(l=*)"
Else
strSearchField = "(l=*" & txt_city.Value & "*)"
End If
Case "txt_state"
If txt_state.Value = "" Then
strSearchField = "(st=*)"
Else
strSearchField = "(st=*" & txt_state.Value & "*)"
End If
Case "txt_zipcode"
If txt_zipcode.Value = "" Then
strSearchField = "(postalCode=*)"
Else
strSearchField = "(postalCode=*" & txt_zipcode.Value & "*)"
End If
Case "txt_country"
If txt_country.Value = "" Then
strSearchField = "(c=*)"
Else
strSearchField = "(c=*" & txt_country.Value & "*)"
End If
Case "txt_homephone"
If txt_homephone.Value = "" Then
strSearchField = "(homePhone=*)"
Else
strSearchField = "(homePhone=*" & txt_homephone.Value & "*)"
End If
Case "txt_managerseen"
If txt_managerseen.Value = "" Then
strSearchField = "(manager=*)"
Else
strSearchField = GetManagerDN(txt_managerseen.Value)
End If
Case "txt_whencreated"
If txt_whencreated.Value = "" Then
strSearchField = "(whenCreated=*)"
Else
if NOT IsDate(txt_whencreated.Value) then
msgbox "Invalid date - enter as dd/mm/yyyy"
strSearchField = "INVALID"
else
strWhenCreated = Year(txt_whencreated.Value) & Right("0" & Month(txt_whencreated.Value), 2) & Right("0" & Day(txt_whencreated.Value), 2)
strSearchField = "(whenCreated>=" & strWhenCreated & "000000.0Z)(whenCreated<=" & strWhenCreated & "235959.0Z)"
end if
End If
Case Else
strSearchField = "INVALID"
End Select
if btnPush = "Disabled" then
strSearchField = "(samAccountName=*)"
end if
if btnPush = "Group" then
For i = 0 to (lst_groupnames.Options.Length - 1)
If (lst_groupnames.Options(i).Selected) Then
arrGroupNames = split(lst_groupnames.Options(i).Value,";")
sprimaryGroupID = arrGroupNames(0)
sMemberOf = arrGroupNames(1)
End If
Next
if sprimaryGroupID = 513 then
strSearchField = "(primaryGroupID=" & sprimaryGroupID & ")"
else
strSearchField = "(memberOf=" & sMemberOf & ")"
end if
end if
if btnPush = "Subordinate" then
For i = 0 to (lst_subordinates.Options.Length - 1)
If (lst_subordinates.Options(i).Selected) Then
arrSubordinateNames = split(lst_subordinates.Options(i).Value,";")
strSearchField = "(samAccountName=*" & arrSubordinateNames(0) & "*)"
End If
Next
end if
if btnPush = "DisabledToday" then
strWhenChanged = Year(txt_whencreated.Value) & Right("0" & Month(txt_whencreated.Value), 2) & Right("0" & Day(txt_whencreated.Value), 2)
strSearchField = "(samAccountName=*)(whenChanged>=" & strWhenChanged & "000000.0Z)(whenChanged<=" & strWhenChanged & "235959.0Z)"
end if
if btnPush = "FileOpen" then
strSearchField = globalStrSearchField
btnPush = globalStrSearchBtnPush
End if
Clear_Form
If strSearchField <> "INVALID" Then
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
' Search entire Active Directory domain.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
'strFilter = "(&(objectClass=computer)(cn=" & strComputer & "))"
' Comma delimited list of attribute values to retrieve.
strAttributes = "physicalDeliveryOfficeName,TelephoneNumber,description,Department,Title,cn,samAccountName,mail,Info,Mobile,company,streetAddress,l,st,postalCode,c,homePhone,manager,whenCreated,distinguishedName,userAccountControl"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
strDetails = ""
If Not adoRecordset.EOF Then
Do Until adoRecordset.EOF
if btnPush = "Disabled" OR btnPush = "DisabledToday" then
if adoRecordset.Fields("userAccountControl").Value AND 2 then
If strDetails <> "" Then strDetails = strDetails & "|TR|"
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If InStr(LCase(adoRecordset.Fields("Info").Value), "location : ") > 0 Then
strBuilding = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), "location : ")))
strBuilding = Mid(strBuilding, 12)
Else
strBuilding = ""
End If
If InStr(LCase(adoRecordset.Fields("Info").Value), lcase("serial no : ")) > 0 Then
strSerialNumber = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), lcase("serial no : "))))
strSerialNumber = Mid(strSerialNumber, 13)
strSerialNumber = replace(strSerialNumber,vbCRLF,"")
Else
strSerialNumber = ""
End If
strDetails = strDetails & replace(strBuilding,vbCRLF,"")
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
"|TD|" & adoRecordset.Fields("TelephoneNumber").Value
If IsNull(adoRecordset.Fields("Description").Value) = False Then
strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value &_
"|TD|" & adoRecordset.Fields("Title").Value &_
"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("mail").Value
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If Left(LCase(adoRecordset.Fields("Info").Value), 15) = LCase("Machine Name : ") Then
strInfo = Trim(Mid(adoRecordset.Fields("Info").Value, 15))
strInfo = Replace(UCase(strInfo), UCase("Location : " & strBuilding), "")
Else
strInfo = adoRecordset.Fields("Info").Value
End If
strDetails = strDetails & "|TD|" & replace(strInfo,vbCRLF,"")
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
"|TD|" & adoRecordset.Fields("company").Value &_
"|TD|" & adoRecordset.Fields("streetAddress").Value &_
"|TD|" & adoRecordset.Fields("l").Value &_
"|TD|" & adoRecordset.Fields("st").Value &_
"|TD|" & adoRecordset.Fields("postalCode").Value &_
"|TD|" & adoRecordset.Fields("c").Value &_
"|TD|" & adoRecordset.Fields("homePhone").Value &_
"|TD|" & adoRecordset.Fields("manager").Value &_
"|TD|" & adoRecordset.Fields("whenCreated").Value &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("distinguishedName").Value &_
"|TD|" & intLastLogonTime & _
"|TD|" & strSerialNumber
strDetails = replace(strDetails,vbCRLF,"")
end if
else
If strDetails <> "" Then strDetails = strDetails & "|TR|"
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If InStr(LCase(adoRecordset.Fields("Info").Value), "location : ") > 0 Then
strBuilding = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), "location : ")))
strBuilding = Mid(strBuilding, 12)
Else
strBuilding = ""
End If
If InStr(LCase(adoRecordset.Fields("Info").Value), lcase("serial no : ")) > 0 Then
strSerialNumber = Trim(Mid(adoRecordset.Fields("Info").Value, InStr(LCase(adoRecordset.Fields("Info").Value), lcase("serial no : "))))
strSerialNumber = Mid(strSerialNumber, 13)
strSerialNumber = replace(strSerialNumber,vbCRLF,"")
Else
strSerialNumber = ""
End If
strDetails = strDetails & replace(strBuilding,vbCRLF,"")
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("physicalDeliveryOfficeName").Value &_
"|TD|" & adoRecordset.Fields("TelephoneNumber").Value
If IsNull(adoRecordset.Fields("Description").Value) = False Then
strDetails = strDetails & "|TD|" & Join(adoRecordset.Fields("description").Value)
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Department").Value &_
"|TD|" & adoRecordset.Fields("Title").Value &_
"|TD|" & Replace(adoRecordset.Fields("cn").Value, "CN=", "") &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("mail").Value
If IsNull(adoRecordset.Fields("Info").Value) = False Then
If Left(LCase(adoRecordset.Fields("Info").Value), 15) = LCase("Machine Name : ") Then
strInfo = Trim(Mid(adoRecordset.Fields("Info").Value, 15))
strInfo = Replace(UCase(strInfo), UCase("Location : " & strBuilding), "")
Else
strInfo = adoRecordset.Fields("Info").Value
End If
strDetails = strDetails & "|TD|" & replace(strInfo,vbCRLF,"")
Else
strDetails = strDetails & "|TD|"
End If
strDetails = strDetails & "|TD|" & adoRecordset.Fields("Mobile").Value &_
"|TD|" & adoRecordset.Fields("company").Value &_
"|TD|" & adoRecordset.Fields("streetAddress").Value &_
"|TD|" & adoRecordset.Fields("l").Value &_
"|TD|" & adoRecordset.Fields("st").Value &_
"|TD|" & adoRecordset.Fields("postalCode").Value &_
"|TD|" & adoRecordset.Fields("c").Value &_
"|TD|" & adoRecordset.Fields("homePhone").Value &_
"|TD|" & adoRecordset.Fields("manager").Value &_
"|TD|" & adoRecordset.Fields("whenCreated").Value &_
"|TD|" & adoRecordset.Fields("samAccountName").Value &_
"|TD|" & adoRecordset.Fields("distinguishedName").Value &_
"|TD|" & intLastLogonTime & _
"|TD|" & strSerialNumber
strDetails = replace(strDetails,vbCRLF,"")
end if
adoRecordset.MoveNext
Loop
Else
MsgBox "No records were found"
End If
' Clean up.
adoRecordset.Close
Set adoRecordset = Nothing
adoConnection.Close
If strDetails <> "" Then
arrRows = ""
arrRows = Split(strDetails, "|TR|")
If UBound(arrRows) < 0 Then
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
Else
arrData = Split(arrRows(0), "|TD|")
txt_seatno.Value = arrData(0)
txt_building.Value = arrData(1)
txt_extensionno.Value = arrData(2)
txt_empid.Value = arrData(3)
txt_department.Value = arrData(4)
txt_designation.Value = arrData(5)
txt_name.Value = arrData(6)
txt_loginname.Value = arrData(7)
txt_email.Value = arrData(8)
txt_notes.Value = arrData(9)
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
txt_oupathcomputer.value = GetOUPath(replace(arrTemp(0),"""",""))
txt_computeros.value = replace(arrTemp(1),"""","")
txt_computerservicepack.value = replace(arrTemp(2),"""","")
txt_computerdescription.value = replace(arrTemp(4),"""","")
txt_computercreated.value = replace(arrTemp(3),"""","")
else
txt_oupathcomputer.value = ""
txt_computeros.value = ""
txt_computerservicepack.value = ""
txt_computerdescription.value = ""
txt_computercreated.value = ""
end if
txt_mobileno.Value = arrData(10)
txt_company.Value = arrData(11)
txt_address.Value = arrData(12)
txt_city.Value = arrData(13)
txt_state.Value = arrData(14)
txt_zipcode.Value = arrData(15)
txt_country.Value = arrData(16)
txt_homephone.Value = arrData(17)
txt_manager.Value = arrData(18)
if txt_manager.Value <> "" then
txt_managerseen.Value = mid(txt_manager.Value,4,instr(txt_manager.Value,",")-4)
else
txt_managerseen.Value = txt_manager.Value
end if
txt_whencreated.Value = arrData(19)
txt_oupathuser.value = GetOUPath(arrData(21))
FillGroupMembershipList arrData(20),arrData(21)
span_currentrecord.InnerHTML = "1"
span_totalrecords.InnerHTML = UBound(arrRows) + 1
End If
Else
span_currentrecord.InnerHTML = "0"
span_totalrecords.InnerHTML = "0"
End If
If strDetails = "" Then
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = True
btnEMailAllRecords.Disabled = True
btnEmailAsAttachment.Disabled = True
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Hidden"
btnEMailAllRecords.Style.Visibility = "Hidden"
btnEmailAsAttachment.Style.Visibility = "Hidden"
ElseIf UBound(arrRows) = 0 Then
btnFirstEvent.Disabled = True
btnPreviousEvent.Disabled = True
btnNextEvent.Disabled = True
btnLastEvent.Disabled = True
btnEmailThisRecord.Disabled = False
btnEMailAllRecords.Disabled = False
btnEmailAsAttachment.Disabled = False
btnFirstEvent.Style.Visibility = "Hidden"
btnPreviousEvent.Style.Visibility = "Hidden"
btnNextEvent.Style.Visibility = "Hidden"
btnLastEvent.Style.Visibility = "Hidden"
btnEmailThisRecord.Style.Visibility = "Visible"
btnEMailAllRecords.Style.Visibility = "Visible"
btnEmailAsAttachment.Style.Visibility = "Visible"
Else
btnFirstEvent.Disabled = False
btnPreviousEvent.Disabled = False
btnNextEvent.Disabled = False
btnLastEvent.Disabled = False
btnEmailThisRecord.Disabled = False
btnEMailAllRecords.Disabled = False
btnEmailAsAttachment.Disabled = False
btnFirstEvent.Style.Visibility = "Visible"
btnPreviousEvent.Style.Visibility = "Visible"
btnNextEvent.Style.Visibility = "Visible"
btnLastEvent.Style.Visibility = "Visible"
btnEmailThisRecord.Style.Visibility = "Visible"
btnEMailAllRecords.Style.Visibility = "Visible"
btnEmailAsAttachment.Style.Visibility = "Visible"
End If
globalStrSearchBtnPush = BtnPush
globalstrSearchField = strSearchField
if chk_qbrecorder.Checked then
AddToQueryBuilder
end if
Else
MsgBox "Please type a search request into one of the fields, then click Submit."
End If
if InStr(Join(arrFields),strCurrentField) then
execute(strCurrentField & ".focus")
execute(strCurrentField & ".select()")
end if
End Sub
Sub Get_Event
arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
txt_seatno.Value = arrData(0)
txt_building.Value = arrData(1)
txt_extensionno.Value = arrData(2)
txt_empid.Value = arrData(3)
txt_department.Value = arrData(4)
txt_designation.Value = arrData(5)
txt_name.Value = arrData(6)
txt_loginname.Value = arrData(7)
txt_email.Value = arrData(8)
txt_notes.Value = arrData(9)
txt_computerserialno.Value = arrData(23)
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
txt_oupathcomputer.value = GetOUPath(replace(arrTemp(0),"""",""))
txt_computeros.value = replace(arrTemp(1),"""","")
txt_computerservicepack.value = replace(arrTemp(2),"""","")
txt_computerdescription.value = replace(arrTemp(4),"""","")
txt_computercreated.value = replace(arrTemp(3),"""","")
else
txt_oupathcomputer.value = ""
txt_computeros.value = ""
txt_computerservicepack.value = ""
txt_computerdescription.value = ""
txt_computercreated.value = ""
End if
txt_mobileno.Value = arrData(10)
txt_company.Value = arrData(11)
txt_address.Value = arrData(12)
txt_city.Value = arrData(13)
txt_state.Value = arrData(14)
txt_zipcode.Value = arrData(15)
txt_country.Value = arrData(16)
txt_homephone.Value = arrData(17)
txt_manager.Value = arrData(18)
if txt_manager.Value <> "" then
txt_managerseen.Value = mid(txt_manager.Value,4,instr(txt_manager.Value,",")-4)
else
txt_managerseen.Value = txt_manager.Value
end if
txt_whencreated.Value = arrData(19)
txt_oupathuser.value = GetOUPath(arrData(21))
sUserName = arrData(20)
sDistName = arrData(21)
End Sub
Sub First_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML < 1 Then
MsgBox "There are no records to display"
ElseIf span_currentrecord.InnerHTML = 1 Then
MsgBox "You are already viewing the first record."
Else
span_currentrecord.InnerHTML = 1
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Previous_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_currentrecord.InnerHTML > 1 Then
span_currentrecord.InnerHTML = span_currentrecord.InnerHTML - 1
Get_Event
FillGroupMembershipList sUserName, sDistName
ElseIf span_currentrecord.InnerHTML = 1 Then
MsgBox "You are already viewing the first record."
Else
MsgBox "There are no records to display"
End If
End If
End Sub
Sub Next_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML = 0 Then
MsgBox "There are no records for to display"
ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
MsgBox "You are already viewing the last record."
Else
span_currentrecord.InnerHTML = span_currentrecord.InnerHTML + 1
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Last_Event
If IsArray(arrRows) = False Then
MsgBox "There are no records to display."
Else
If span_totalrecords.InnerHTML = 0 Then
MsgBox "There are no records to display"
ElseIf span_currentrecord.InnerHTML = span_totalrecords.InnerHTML Then
MsgBox "You are already viewing the last record."
Else
span_currentrecord.InnerHTML = span_totalrecords.InnerHTML
Get_Event
FillGroupMembershipList sUserName, sDistName
End If
End If
End Sub
Sub Detect_Search_Field(strCurrentField)
arrFields = Array(_
"txt_seatno", _
"txt_building", _
"txt_extensionno", _
"txt_empid", _
"txt_department", _
"txt_designation", _
"txt_name", _
"txt_loginname", _
"txt_email", _
"txt_notes", _
"txt_computerserialno", _
"txt_replacedmachine", _
"txt_oupathcomputer", _
"txt_computeros", _
"txt_computerservicepack", _
"txt_computerdescription", _
"txt_computercreated", _
"txt_mobileno", _
"txt_company", _
"txt_address", _
"txt_city", _
"txt_state", _
"txt_zipcode", _
"txt_country", _
"txt_homephone", _
"txt_managerseen", _
"txt_whencreated", _
"txt_oupathuser" _
)
For Each strField In arrFields
If LCase(strField) <> LCase(strCurrentField) Then
Execute strField & ".style.backgroundColor=""#D3D3D3"""
Execute strField & ".Disabled = True"
End If
Next
End Sub
Sub RunScript
strAnswer = window.prompt("Please enter the path and file name to save.", "D:\HTAResults.csv")
If IsNull(strAnswer) Then
Msgbox "You clicked the Cancel button"
Else
if globalstrSearchBtnPush <> "" then
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAnswer) = True Then
objFSO.DeleteFile strAnswer, True
'Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
Else
' do nothing
end if
Dim arrHeader()
x = 0
if chk_seatno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Seat No"""
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Building"""
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Extension"""
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Emp ID"""
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Department"""
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Designation"""
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """User Name"""
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Login Name"""
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Email Address"""
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer"""
x = x + 1
end if
if chk_computerserialno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Serial No"""
x = x + 1
end if
if chk_oupathcomputer.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - Computer"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer OS"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Service Pack"""
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Description"""
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Account Created"""
x = x + 1
end if
if chk_mobileno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Mobile"""
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Company"""
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Address"""
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """City"""
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """State"""
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Zip Code"""
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Country"""
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Home Phone"""
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Manager"""
x = x + 1
end if
if chk_subordinates.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Subordinates"""
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Date Created"""
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - User"""
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Group Membership"""
x = x + 1
end if
strHeader = Join(arrHeader,",")
Set objFile = objFSO.CreateTextFile(strAnswer, True)
objFile.Write strHeader
Dim arrFileData()
For intRow = LBound(arrRows) To UBound(arrRows)
arrData = Split(arrRows(intRow), "|TD|")
x = 0
if chk_seatno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(0) & """"
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(1) & """"
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(2) & """"
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(3) & """"
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(4) & """"
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(5) & """"
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(6) & """"
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(7) & """"
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(8) & """"
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(9) & """"
x = x + 1
end if
if chk_computerserialno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(23) & """"
x = x + 1
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(replace(arrTemp(0),"""","")) & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(1),"""","") & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(2),"""","") & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(4),"""","") & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(3),"""","") & """"
x = x + 1
end if
else
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
end if
if chk_mobileno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(10) & """"
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(11) & """"
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(12) & """"
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(13) & """"
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(14) & """"
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(15) & """"
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(16) & """"
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(17) & """"
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrFileData(x)
if arrData(18) <> "" then
arrFileData(x) = """" & mid(arrData(18),4,instr(arrData(18),",")-4) & """"
else
arrFileData(x) = """" & """"
end if
x = x + 1
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = ""
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & str_subordinates & """"
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(19) & """"
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(arrData(21)) & """"
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & ReportGroupMemberShipList(arrData(20),arrData(21)) & """"
x = x + 1
end if
strFileDate = Join(arrFileData,",")
objFile.Write VbCrLf & strFileDate
Next
objFile.Close
MsgBox "Saved."
else
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAnswer) = True Then
objFSO.DeleteFile strAnswer, True
Else
' do nothing
end if
Set objFile = objFSO.CreateTextFile(strAnswer, True)
objFile.Write """Groups""" & VbCrLf
For Each objOption in lst_groupnames.Options
objFile.Write """" & objOption.Text & """" & VbCrLf
Next
objFile.Close
MsgBox "Saved."
End if
End If
End Sub
Sub Email_This_Record
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
if chk_seatno.Checked then
str_seatno = "<b>Seat No: </b>" & txt_seatno.value & "<br>" & vbCRLF
else
str_seatno = ""
end if
if chk_replacementseatno.Checked then
str_replacementseatno = "<b>Replacement Seat No: </b>" & txt_replacementseatno.value & "<br>" & vbCRLF
else
str_replacementseatno = ""
end if
if chk_building.Checked then
str_building = "<b>Building: </b>" & txt_building.value & "<br>" & vbCRLF
else
str_building = ""
end if
if chk_extensionno.Checked then
str_extensionno = "<b>Extension No: </b>" & txt_extensionno.value & "<br>" & vbCRLF
else
str_extensionno = ""
end if
if chk_empid.Checked then
str_empid = "<b>Emp ID: </b>" & txt_empid.value & "<br>" & vbCRLF
else
str_empid = ""
end if
if chk_department.Checked then
str_department = "<b>Department: </b>" & txt_department.value & "<br>" & vbCRLF
else
str_department = ""
end if
if chk_designation.Checked then
str_designation = "<b>Designation: </b>" & txt_designation.value & "<br>" & vbCRLF
else
str_designation = ""
end if
if chk_name.Checked then
str_name = "<b>User Name: </b>" & txt_name.value & "<br>" & vbCRLF
else
str_name = ""
end if
if chk_loginname.Checked then
str_loginname = "<b>Login Name: </b>" & txt_loginname.value & "<br>" & vbCRLF
else
str_loginname = ""
end if
if chk_email.Checked then
str_email = "<b>Email Address: </b>" & txt_email.value & "<br>" & vbCRLF
else
str_email = ""
end if
if chk_notes.Checked then
str_notes = "<b>Machine Name: </b>" & txt_notes.value & "<br>" & vbCRLF
else
str_notes = ""
end if
if chk_computerserialno.Checked then
str_computerserialno = "<b>Serial No: </b>" & txt_computerserialno.value & "<br>" & vbCRLF
else
str_computerserialno = ""
end if
if chk_replacedmachine.Checked then
str_replacedmachine = "<b>Replaced Machine: </b>" & txt_replacedmachine.value & "<br>" & vbCRLF
else
str_replacedmachine = ""
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & txt_oupathcomputer.value & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & txt_computeros.value & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & txt_computerservicepack.value & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & txt_computerdescription.value & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & txt_computercreated.value & "<br>" & vbCRLF
else
str_computercreated = ""
end if
else
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & "<br>" & vbCRLF
else
str_computercreated = ""
end if
end if
if chk_mobileno.Checked then
str_mobileno = "<b>Mobile Number: </b>" & txt_mobileno.value & "<br>" & vbCRLF
else
str_mobileno = ""
end if
if chk_company.Checked then
str_company = "<b>Company: </b>" & txt_company.value & "<br>" & vbCRLF
else
str_company = ""
end if
if chk_address.Checked then
str_address = "<b>Address: </b>" & txt_address.value & "<br>" & vbCRLF
else
str_address = ""
end if
if chk_city.Checked then
str_city = "<b>City: </b>" & txt_city.value & "<br>" & vbCRLF
else
str_city = ""
end if
if chk_state.Checked then
str_state = "<b>State: </b>" & txt_state.value & "<br>" & vbCRLF
else
str_state = ""
end if
if chk_zipcode.Checked then
str_zipcode = "<b>Zip Code: </b>" & txt_zipcode.value & "<br>" & vbCRLF
else
str_zipcode = ""
end if
if chk_country.Checked then
str_country = "<b>Country: </b>" & txt_country.value & "<br>" & vbCRLF
else
str_country = ""
end if
if chk_homephone.Checked then
str_homephone = "<b>Home Phone: </b>" & txt_homephone.value & "<br>" & vbCRLF
else
str_homephone = ""
end if
if chk_manager.Checked then
if arrData(18) <> "" then
str_manager = "<b>Manager: </b>" & mid(arrData(18),4,instr(arrData(18),",")-4) & "<br>" & vbCRLF
else
str_manager = ""
end if
else
str_manager = ""
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = "<b>Subordinates: </b>"
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
str_subordinates = str_subordinates & "<br>" & vbCRLF
else
str_subordinates = ""
end if
if chk_whencreated.Checked then
str_whencreated = "<b>Date Created: </b>" & txt_whencreated.value & "<br>" & vbCRLF
else
str_whencreated = ""
end if
if chk_oupathuser.Checked then
str_oupathuser = "<b>OU Path - User: </b>" & txt_oupathuser.value & "<br>" & vbCRLF
else
str_oupathuser = ""
end if
if chk_groupmembership.Checked then
str_groupmembership = "<b>Group Membership: </b>" & ReportGroupMemberShipList(arrData(20),arrData(21)) & "<br>" & vbCRLF
else
str_groupmembership = ""
end if
str_message = str_seatno & _
str_replacementseatno & _
str_building & _
str_extensionno & _
str_empid & _
str_department & _
str_designation & _
str_name & _
str_loginname & _
str_email & _
str_notes & _
str_computerserialno & _
str_replacedmachine & _
str_oupathcomputer & _
str_computeros & _
str_computerservicepack & _
str_computerdescription & _
str_computercreated & _
str_mobileno & _
str_company & _
str_address & _
str_city & _
str_state & _
str_zipcode & _
str_country & _
str_homephone & _
str_manager & _
str_subordinates & _
str_whencreated & _
str_oupathuser & _
str_groupmembership
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.HTMLBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF & str_message
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "An email has been sent"
End Sub
Sub Email_All_Records
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
str_message = ""
for n = 0 to UBound(arrRows)
arrData = Split(arrRows(n), "|TD|")
if chk_seatno.Checked then
str_seatno = "<b>Seat No: </b>" & arrData(0) & "<br>" & vbCRLF
else
str_seatno = ""
end if
if chk_building.Checked then
str_building = "<b>Building: </b>" & arrData(1) & "<br>" & vbCRLF
else
str_building = ""
end if
if chk_extensionno.Checked then
str_extensionno = "<b>Extension No: </b>" & arrData(2) & "<br>" & vbCRLF
else
str_extensionno = ""
end if
if chk_empid.Checked then
str_empid = "<b>Emp ID: </b>" & arrData(3) & "<br>" & vbCRLF
else
str_empid = ""
end if
if chk_department.Checked then
str_department = "<b>Department: </b>" & arrData(4) & "<br>" & vbCRLF
else
str_department = ""
end if
if chk_designation.Checked then
str_designation = "<b>Designation: </b>" & arrData(5) & "<br>" & vbCRLF
else
str_designation = ""
end if
if chk_name.Checked then
str_name = "<b>User Name: </b>" & arrData(6) & "<br>" & vbCRLF
else
str_name = ""
end if
if chk_loginname.Checked then
str_loginname = "<b>Login Name: </b>" & arrData(7) & "<br>" & vbCRLF
else
str_loginname = ""
end if
if chk_email.Checked then
str_email = "<b>Email Address: </b>" & arrData(8) & "<br>" & vbCRLF
else
str_email = ""
end if
if chk_notes.Checked then
str_notes = "<b>Machine Name: </b>" & arrData(9) & "<br>" & vbCRLF
else
str_notes = ""
end if
if chk_computerserialno.Checked then
str_computerserialno = "<b>Serial No: </b>" & arrData(23) & "<br>" & vbCRLF
else
str_computerserialno = ""
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & GetOUPath(replace(arrTemp(0),"""","")) & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & replace(arrTemp(1),"""","") & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & replace(arrTemp(2),"""","") & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & replace(arrTemp(4),"""","") & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & replace(arrTemp(3),"""","") & "<br>" & vbCRLF
else
str_computercreated = ""
end if
else
if chk_oupathcomputer.Checked then
str_oupathcomputer = "<b>OU Path - Computer: </b>" & "<br>" & vbCRLF
else
str_oupathcomputer = ""
end if
if chk_computeros.Checked then
str_computeros = "<b>Computer OS: </b>" & "<br>" & vbCRLF
else
str_computeros = ""
end if
if chk_computeros.Checked then
str_computerservicepack = "<b>Service Pack: </b>" & "<br>" & vbCRLF
else
str_computerservicepack = ""
end if
if chk_computerdescription.Checked then
str_computerdescription = "<b>Computer Description: </b>" & "<br>" & vbCRLF
else
str_computerdescription = ""
end if
if chk_computercreated.Checked then
str_computercreated = "<b>Computer Account Created: </b>" & "<br>" & vbCRLF
else
str_computercreated = ""
end if
end if
if chk_mobileno.Checked then
str_mobileno = "<b>Mobile Number: </b>" & arrData(10) & "<br>" & vbCRLF
else
str_mobileno = ""
end if
if chk_company.Checked then
str_company = "<b>Company: </b>" & arrData(11) & "<br>" & vbCRLF
else
str_company = ""
end if
if chk_address.Checked then
str_address = "<b>Address: </b>" & arrData(12) & "<br>" & vbCRLF
else
str_address = ""
end if
if chk_city.Checked then
str_city = "<b>City: </b>" & arrData(13) & "<br>" & vbCRLF
else
str_city = ""
end if
if chk_state.Checked then
str_state = "<b>State: </b>" & arrData(14) & "<br>" & vbCRLF
else
str_state = ""
end if
if chk_zipcode.Checked then
str_zipcode = "<b>Zip Code: </b>" & arrData(15) & "<br>" & vbCRLF
else
str_zipcode = ""
end if
if chk_country.Checked then
str_country = "<b>Country: </b>" & arrData(16) & "<br>" & vbCRLF
else
str_country = ""
end if
if chk_homephone.Checked then
str_homephone = "<b>Home Phone: </b>" & arrData(17) & "<br>" & vbCRLF
else
str_homephone = ""
end if
if chk_manager.Checked then
if arrData(18) <> "" then
str_manager = "<b>Manager: </b>" & mid(arrData(18),4,instr(arrData(18),",")-4) & "<br>" & vbCRLF
else
str_manager = ""
end if
else
str_manager = ""
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = "<b>Subordinates: </b>"
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
str_subordinates = str_subordinates & "<br>" & vbCRLF
else
str_subordinates = ""
end if
if chk_whencreated.Checked then
str_whencreated = "<b>Date Created: </b>" & arrData(19) & "<br>" & vbCRLF
else
str_whencreated = ""
end if
if chk_oupathuser.Checked then
str_oupathuser = "<b>OU Path - User: </b>" & GetOUPath(arrData(21)) & "<br>" & vbCRLF
else
str_oupathuser = ""
end if
if chk_groupmembership.Checked then
str_groupmembership = "<b>Group Membership: </b>" & ReportGroupMemberShipList(arrData(20),arrData(21)) & "<br>" & vbCRLF
else
str_groupmembership = ""
end if
str_message = str_message & _
str_seatno & _
str_building & _
str_extensionno & _
str_empid & _
str_department & _
str_designation & _
str_name & _
str_loginname & _
str_email & _
str_notes & _
str_computerserialno & _
str_oupathcomputer & _
str_computeros & _
str_computerservicepack & _
str_computerdescription & _
str_computercreated & _
str_mobileno & _
str_company & _
str_address & _
str_city & _
str_state & _
str_zipcode & _
str_country & _
str_homephone & _
str_manager & _
str_subordinates & _
str_whencreated & _
str_oupathuser & _
str_groupmembership & VbCrLf & "<br><hr><br><br>" & vbCRLF
next
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.HTMLBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF & str_message
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
MsgBox "An email has been sent"
End Sub
Sub Email_As_Attachment
ShowDialogTo
ShowDialogCC
ConvertNamesToEmailAddresses
strAnswer = fTemp & "\HTAResults.csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAnswer) = True Then
objFSO.DeleteFile strAnswer, True
'Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
Else
'do nothing
end if
Dim arrHeader()
x = 0
if chk_seatno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Seat No"""
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Building"""
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Extension"""
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Emp ID"""
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Department"""
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Designation"""
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """User Name"""
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Login Name"""
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Email Address"""
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer"""
x = x + 1
end if
if chk_computerserialno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Serial No"""
x = x + 1
end if
if chk_oupathcomputer.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - Computer"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer OS"""
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Service Pack"""
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Description"""
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Computer Account Created"""
x = x + 1
end if
if chk_mobileno.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Mobile"""
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Company"""
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Address"""
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """City"""
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """State"""
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Zip Code"""
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Country"""
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Home Phone"""
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Manager"""
x = x + 1
end if
if chk_subordinates.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Subordinates"""
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Date Created"""
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """OU Path - User"""
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrHeader(x)
arrHeader(x) = """Group Membership"""
x = x + 1
end if
strHeader = Join(arrHeader,",")
Set objFile = objFSO.CreateTextFile(strAnswer, True)
objFile.Write strHeader
Dim arrFileData()
For intRow = LBound(arrRows) To UBound(arrRows)
arrData = Split(arrRows(intRow), "|TD|")
x = 0
if chk_seatno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(0) & """"
x = x + 1
end if
if chk_building.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(1) & """"
x = x + 1
end if
if chk_extensionno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(2) & """"
x = x + 1
end if
if chk_empid.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(3) & """"
x = x + 1
end if
if chk_department.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(4) & """"
x = x + 1
end if
if chk_designation.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(5) & """"
x = x + 1
end if
if chk_name.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(6) & """"
x = x + 1
end if
if chk_loginname.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(7) & """"
x = x + 1
end if
if chk_email.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(8) & """"
x = x + 1
end if
if chk_notes.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(9) & """"
x = x + 1
end if
if chk_computerserialno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(23) & """"
x = x + 1
end if
arrTemp = GetComputerInfo(arrData(9))
if IsArray(arrTemp) then
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(replace(arrTemp(0),"""","")) & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(1),"""","") & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(2),"""","") & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(4),"""","") & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & replace(arrTemp(3),"""","") & """"
x = x + 1
end if
else
if chk_oupathcomputer.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computeros.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computerdescription.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
if chk_computercreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & """"
x = x + 1
end if
end if
if chk_mobileno.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(10) & """"
x = x + 1
end if
if chk_company.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(11) & """"
x = x + 1
end if
if chk_address.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(12) & """"
x = x + 1
end if
if chk_city.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(13) & """"
x = x + 1
end if
if chk_state.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(14) & """"
x = x + 1
end if
if chk_zipcode.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(15) & """"
x = x + 1
end if
if chk_country.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(16) & """"
x = x + 1
end if
if chk_homephone.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(17) & """"
x = x + 1
end if
if chk_manager.Checked then
ReDim Preserve arrFileData(x)
if arrData(18) <> "" then
arrFileData(x) = """" & mid(arrData(18),4,instr(arrData(18),",")-4) & """"
else
arrFileData(x) = """" & """"
end if
x = x + 1
end if
if chk_subordinates.Checked then
strSearchField = "(manager=" & arrData(21) & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
boolFoundFirst = False
str_subordinates = ""
Do Until adoRecordset.EOF
strField = adoRecordset.Fields("cn").Value
if boolFoundFirst then
str_subordinates = str_subordinates & ", " & strField
else
boolFoundFirst = True
str_subordinates = str_subordinates & strField
end if
adoRecordset.MoveNext
Loop
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & str_subordinates & """"
x = x + 1
end if
if chk_whencreated.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & arrData(19) & """"
x = x + 1
end if
if chk_oupathuser.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & GetOUPath(arrData(21)) & """"
x = x + 1
end if
if chk_groupmembership.Checked then
ReDim Preserve arrFileData(x)
arrFileData(x) = """" & ReportGroupMemberShipList(arrData(20),arrData(21)) & """"
x = x + 1
end if
strFileDate = Join(arrFileData,",")
objFile.Write VbCrLf & strFileDate
Next
objFile.Close
if trim(txt_EmailSubject.value) = "" then
strEmailSubject = "Active Directory Detail Report"
else
strEmailSubject = trim(txt_EmailSubject.value)
end if
Set objMessage = CreateObject("CDO.Message")
objMessage.From = strEmailFrom
objMessage.To = strEmailTo
objMessage.CC = strEmailCC
objMessage.BCC = strEmailBCC
objMessage.Subject = strEmailSubject
objMessage.TextBody = trim(txt_EmailBody.value) & vbCRLF & vbCRLF
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strEmailServer
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.AddAttachment strAnswer
objMessage.Send
MsgBox "An email has been sent"
objFSO.DeleteFile strAnswer, True
End Sub
Sub SelectAllCheck
If chk_selectall.Checked then
chk_seatno.Checked = True
chk_replacementseatno.Checked = True
chk_building.Checked = True
chk_extensionno.Checked = True
chk_empid.Checked = True
chk_department.Checked = True
chk_designation.Checked = True
chk_name.Checked = True
chk_loginname.Checked = True
chk_email.Checked = True
chk_notes.Checked = True
chk_computerserialno.Checked = True
chk_replacedmachine.Checked = True
chk_oupathcomputer.Checked = True
chk_computeros.Checked = True
chk_computerdescription.Checked = True
chk_computercreated.Checked = True
chk_mobileno.Checked = True
chk_company.Checked = True
chk_address.Checked = True
chk_city.Checked = True
chk_state.Checked = True
chk_zipcode.Checked = True
chk_country.Checked = True
chk_homephone.Checked = True
chk_manager.Checked = True
chk_whencreated.Checked = True
chk_oupathuser.Checked = True
chk_groupmembership.Checked = True
chk_subordinates.Checked = True
if tr_seatno.classname="HideFromGUI" then chk_seatno.Checked = False
if tr_replacementseatno.classname="HideFromGUI" then chk_replacementseatno.Checked = False
if tr_building.classname="HideFromGUI" then chk_building.Checked = False
if tr_extensionno.classname="HideFromGUI" then chk_extensionno.Checked = False
if tr_empid.classname="HideFromGUI" then chk_empid.Checked = False
if tr_department.classname="HideFromGUI" then chk_department.Checked = False
if tr_designation.classname="HideFromGUI" then chk_designation.Checked = False
if tr_name.classname="HideFromGUI" then chk_name.Checked = False
if tr_loginname.classname="HideFromGUI" then chk_loginname.Checked = False
if tr_email.classname="HideFromGUI" then chk_email.Checked = False
if tr_mobileno.classname="HideFromGUI" then chk_mobileno.Checked = False
if tr_company.classname="HideFromGUI" then chk_company.Checked = False
if tr_address.classname="HideFromGUI" then chk_address.Checked = False
if tr_city.classname="HideFromGUI" then chk_city.Checked = False
if tr_state.classname="HideFromGUI" then chk_state.Checked = False
if tr_zipcode.classname="HideFromGUI" then chk_zipcode.Checked = False
if tr_country.classname="HideFromGUI" then chk_country.Checked = False
if tr_homephone.classname="HideFromGUI" then chk_homephone.Checked = False
if tr_manager.classname="HideFromGUI" then chk_manager.Checked = False
if tr_whencreated.classname="HideFromGUI" then chk_whencreated.Checked = False
if tr_oupathuser.classname="HideFromGUI" then chk_oupathuser.Checked = False
else
chk_seatno.Checked = False
chk_replacementseatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_seatno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_computerserialno.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
end if
End Sub
Function GetUsersEmailAddress
Set oNet = CreateObject("WScript.NetWork")
sSearchField = "(samAccountName=*" & oNet.UserName & "*)"
Set objRootDSE = GetObject("LDAP://RootDSE")
sDNSDomain = objRootDSE.Get("defaultNamingContext")
sBase = "<LDAP://" & sDNSDomain & ">"
sFilter = "(&(objectCategory=person)(objectClass=user)" & sSearchField & ")"
sAttributes = "cn,samAccountName,mail"
sQuery = sBase & ";" & sFilter & ";" & sAttributes & ";subtree"
Set aCommand = CreateObject("ADODB.Command")
Set aConnection = CreateObject("ADODB.Connection")
aConnection.Provider = "ADsDSOObject"
aConnection.Open "Active Directory Provider"
aCommand.ActiveConnection = aConnection
aCommand.CommandText = sQuery
aCommand.Properties("Page Size") = 100
aCommand.Properties("Timeout") = 30
aCommand.Properties("Cache Results") = False
Set aRecordset = aCommand.Execute
GetUsersEmailAddress = aRecordset.Fields("cn").Value
End Function
Sub ShowDialogCC
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailCC.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailCC.Value = strValidEmail
End Sub
Sub ShowDialogTo
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailTo.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailTo.Value = strValidEmail
End Sub
Sub ShowDialogFrom
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(txt_EmailFrom.Value,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("cn").Value
objRecordSet1.MoveNext
Wend
if intCount = 0 then
msgbox "The name """ & strResolve & """ could not be found. The name has been removed from the field."
end if
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
if intCount > 1 then
strSample = ShowModalDialog("modaldialog.hta",strResolve)
strValidEmail = strValidEmail & strSample & ";"
end if
end if
next
txt_EmailFrom.Value = strValidEmail
End Sub
Sub FillGroupMembershipList(loginname,distinguishedname)
For Each objOption in lst_groupnames.Options
objOption.RemoveNode
Next
For Each objOption in lst_subordinates.Options
objOption.RemoveNode
Next
adsPath = "WinNT://" & mid(strDNSDomain,4,instr(strDNSDomain,",")-4) & "/" & loginname
Set objUser = GetObject(adsPath & ",user")
intGroupID = objUser.primaryGroupID
strFilter = "(|"
For Each Group in objUser.Groups
strFilter = strFilter & "(sAMAccountName=" & Group.name & ")"
Next
strFilter = strFilter & ")"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" _
& strAttributes & ";subtree"
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.CursorLocation = 3
adoRecordset.Sort = "distinguishedname"
adoRecordset.Open strQuery, adoConnection, , , 1
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
set newOption = document.createElement("OPTION")
newOption.Text = strNTName
newOption.Value = strPrimary & ";" & strdistinguishedName
lst_groupnames.Add newOption
adoRecordset.MoveNext
Loop
strSearchField = "(manager=" & distinguishedname & ")"
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)" & strSearchField & ")"
' Comma delimited list of attribute values to retrieve.
strAttributes = "cn,samAccountName,whenCreated,distinguishedName,userAccountControl"
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
set newOption = document.createElement("OPTION")
newOption.Text = adoRecordset.Fields("cn").Value
newOption.Value = adoRecordset.Fields("samAccountName").Value & ";" & adoRecordset.Fields("distinguishedName").Value
lst_subordinates.Add newOption
adoRecordset.MoveNext
Loop
End Sub
Function ReportGroupMembershipList(loginname,distinguishedname)
adsPath = "WinNT://" & mid(strDNSDomain,4,instr(strDNSDomain,",")-4) & "/" & loginname
Set objUser = GetObject(adsPath & ",user")
intGroupID = objUser.primaryGroupID
strFilter = "(|"
For Each Group in objUser.Groups
strFilter = strFilter & "(sAMAccountName=" & Group.name & ")"
Next
strFilter = strFilter & ")"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoConnection = CreateObject("ADODB.Connection")
Set adoCommand = CreateObject("ADODB.Command")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
strQuery = "<LDAP://" & strDNSDomain & ">;" & strFilter & ";" _
& strAttributes & ";subtree"
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.CursorLocation = 3
adoRecordset.Sort = "distinguishedname"
adoRecordset.Open strQuery, adoConnection, , , 1
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
strValue = strValue & strNTName & ";"
adoRecordset.MoveNext
Loop
strValue = mid(strValue,1,len(strValue)-1)
ReportGroupMembershipList = strValue
End Function
Function GetManagerDN(Manager)
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=person)(objectClass=user)(cn=*" & Manager & "*))"
strAttributes = "distinguishedName,CN"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.CursorLocation = 3
adoRecordset.Sort = "distinguishedname"
adoRecordset.Open strQuery, adoConnection, , , 1
strresults = ""
boolResultsFound = False
Do Until adoRecordset.EOF
strDN = adoRecordset.Fields("distinguishedName").Value
sResults = sResults & "(manager=" & strDN & ")"
boolResultsFound = True
adoRecordset.MoveNext
Loop
if boolResultsFound then
sResults = "(|" & sResults & ")"
end if
GetManagerDN = sResults
End Function
Sub FillGroupList
For Each objOption in lst_groupnames.Options
objOption.RemoveNode
Next
set objRootDSE = GetObject("LDAP://RootDSE")
strBase = "<LDAP://cn=Partitions," & _
objRootDSE.Get("ConfigurationNamingContext") & ">;"
strFilter = "(&(objectcategory=crossRef)(systemFlags=3));"
strAttrs = "name,trustParent,nCName,dnsRoot,distinguishedName;"
strScope = "onelevel"
set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)
objRS.MoveFirst
set dicSubDomainTrue = CreateObject("Scripting.Dictionary")
set dicDomainHierarchy = CreateObject("Scripting.Dictionary")
set dicDomainRoot = CreateObject("Scripting.Dictionary")
while not objRS.EOF
dicDomainRoot.Add objRS.Fields("name").Value, objRS.Fields("nCName").Value
if objRS.Fields("trustParent").Value <> "" then
dicSubDomainTrue.Add objRS.Fields("name").Value, 0
set objDomainParent = GetObject("LDAP://" & objRS.Fields("trustParent").Value)
dicDomainHierarchy.Add objRS.Fields("name").Value,objDomainParent.Get("name")
else
dicSubDomainTrue.Add objRS.Fields("name").Value, 1
end if
objRS.MoveNext
wend
for each strDomain in dicSubDomainTrue
if dicSubDomainTrue(strDomain) = 1 then
PopulateGroupList strDomain
end if
next
End Sub
Sub PopulateGroupList(Domain)
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
strBase = "<LDAP://" & Domain & ">"
strFilter = "(objectCategory=group)"
strAttributes = "sAMAccountName,primaryGroupToken,distinguishedName"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.CursorLocation = 3
adoRecordset.Sort = "distinguishedname"
adoRecordset.Open strQuery, adoConnection, , , 1
Do Until adoRecordset.EOF
strNTName = adoRecordset.Fields("sAMAccountName").Value
strPrimary = adoRecordset.Fields("primaryGroupToken").Value
strdistinguishedName = adoRecordset.Fields("distinguishedName").Value
set newOption = document.createElement("OPTION")
newOption.Text = strNTName
newOption.Value = strPrimary & ";" & strdistinguishedName
lst_groupnames.Add newOption
adoRecordset.MoveNext
Loop
End Sub
Sub FillSubjectList
For Each objOption in txt_EmailSubject.Options
objOption.RemoveNode
Next
For each strSubjectlineText in arrSubjectText
set newOption = document.createElement("OPTION")
newOption.Text = strSubjectlineText
newOption.Value = strSubjectlineText
txt_EmailSubject.Add newOption
Next
End Sub
Sub ConvertNamesToEmailAddresses
txt_EmailToHidden.Value = GetEmailAddresses(txt_EmailTo.Value)
txt_EmailCCHidden.Value = GetEmailAddresses(txt_EmailCC.Value)
strEmailTo = txt_EmailToHidden.Value
End Sub
Function GetEmailAddresses(names)
Const adVarChar = 200
Const MaxCharacters = 255
strValidEmail = ""
arrResolve = split(names,";")
for each strResolve in arrResolve
strResolve = trim(strResolve)
if instr(strResolve,"@") then
'Treat as valid email address
strValidEmail = strValidEmail & strResolve & ";"
elseif strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=person)" & _
"(mail=*)(cn=*" & strResolve & "*));cn,samAccountName,mail;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
intCount = 0
While Not objRecordSet1.EOF
intCount = intCount + 1
strFullName = objRecordSet1.Fields("mail").Value
objRecordSet1.MoveNext
Wend
if intCount = 1 then
strValidEmail = strValidEmail & strFullName & ";"
end if
end if
next
GetEmailAddresses = strValidEmail
End Function
Function GetOUPath(OU)
strOU = ""
strFQDN = ""
boolFoundMatch = False
arrValues = split(OU,",")
for each strValue in arrValues
if instr(strValue,"OU=") then
strOU = strOU & replace(strValue,"OU=","") & "\"
end if
if instr(strValue,"DC=") then
strFQDN = strFQDN & replace(strValue,"DC=","") & "."
end if
if instr(strValue,"CN=") then
if boolFoundMatch then
strCN = strCN & replace(strValue,"CN=","") & "\"
else
'Skip the first match - this is always the user name
boolFoundMatch = True
end if
end if
next
if strFQDN <> "" then
strFQDN = left(strFQDN,len(strFQDN)-1)
if strOU <> "" then
strOU = left(strOU,len(strOU)-1)
else
'strOU = "{object not found in any OU}"
if strCN <> "" then
strOU = left(strCN,len(strCN)-1)
end if
end if
GetOUPath = (Split(strOU,"\")(0))
else
GetOUPath = ""
end if
End Function
Function GetComputerInfo(names)
Const adVarChar = 200
Const MaxCharacters = 255
strValidComputer = ""
strResolve = trim(names)
if strResolve <> "" then
Set objRoot = GetObject("LDAP://rootDSE")
strDomain = "LDAP://" & objRoot.Get("defaultNamingContext")
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "<" & strDomain & ">;(&(objectCategory=computer)" & _
"(cn=" & strResolve & "));cn,samAccountName,distinguishedName,operatingsystem,operatingsystemservicepack,whencreated,description;subtree"
objCommand.Properties("Page Size") = 3000
objCommand.Properties("Timeout") = 90
objCommand.Properties("Cache Results") = False
Set objRecordSet1 = objCommand.Execute
While Not objRecordSet1.EOF
if IsNull(objRecordSet1.Fields("distinguishedName").Value) then
sDN = ""
else
sDN = replace(objRecordSet1.Fields("distinguishedName").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("operatingsystem").Value) then
sOS = ""
else
sOS = replace(objRecordSet1.Fields("operatingsystem").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("operatingsystemservicepack").Value) then
sSP = ""
else
sSP = replace(objRecordSet1.Fields("operatingsystemservicepack").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("whencreated").Value) then
sWC = ""
else
sWC = replace(objRecordSet1.Fields("whencreated").Value,vbCRLF,"")
End if
if IsNull(objRecordSet1.Fields("description").Value) then
sDS = ""
else
'this line commented out for testing purposes - should be OK to uncomment.
'sDS = replace(objRecordSet1.Fields("description").Value,vbCRLF,"")
End if
strValidComputer = Array("""" & sDN & """","""" & sOS & """","""" & sSP & """","""" & sWC & """","""" & sDS & """")
objRecordSet1.MoveNext
Wend
end if
if isArray(strValidComputer) then
GetComputerInfo = strValidComputer
else
GetComputerInfo = ""
end if
End Function
'''''''''''''''''''
' Menu management '
'''''''''''''''''''
Sub ShowSubMenu(Parent,Child)
If Child.style.display="block" Then
Parent.classname="Menuover"
Child.style.display="none"
Set LastChildMenu=Nothing
Else
Parent.classname="Menuin"
Child.style.display="block"
Set LastChildMenu=Child
End If
Set LastMenu=Parent
End Sub
Sub MenuOver(Parent,Child)
If LastChildMenu is Nothing Then
Parent.className="MenuOver"
Else
If LastMenu is Parent Then
Parent.className="MenuIn"
Else
HideMenu
ShowSubMenu Parent,Child
End If
End If
End Sub
Sub MenuOut(Menu)
If LastChildMenu is Nothing Then Menu.className="MenuOut"
End Sub
Sub HideMenu
If Not LastChildMenu is Nothing Then
LastChildMenu.style.display="none"
Set LastChildMenu=Nothing
LastMenu.classname="Menuout"
End If
End Sub
Sub SubMenuOver(Menu)
Menu.className="SubMenuOver"
End Sub
Sub SubMenuOut(Menu)
Menu.className="SubMenuOut"
End Sub
'''''''''''''''''''
' File management '
'''''''''''''''''''
Sub SaveAs
on error resume next
Dim oDLG
Set oDLG=CreateObject("MSComDlg.CommonDialog")
if err.number > 0 then
err.clear
oDLG = window.prompt("Please enter the path and file name to save.", "C:\your-query.qry")
if oDLG <> "" then
FileName = oDLG
Save
End If
else
With oDLG
.DialogTitle = "SaveAs"
.Filter="Query|*.qry|Text Files|*.txt|All files|*.*"
.MaxFileSize = 255
.ShowSave
If .FileName <> "" Then
FileName = .FileName
Save
End If
End With
end if
Set oDLG=Nothing
DisplayTitle
End Sub
Sub Save()
Dim fso,f
If FileName <> "" Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(FileName,True)
'This is the text to get saved into the file
with f
.writeline "<root>"
.writeline "<searchfield>" & globalStrSearchField & "</searchfield>"
.writeline "<btnpush>" & globalStrSearchBtnPush & "</btnpush>"
.writeline "<to>" & txt_EmailTo.value & "</to>"
.writeline "<cc>" & txt_EmailCC.value & "</cc>"
.writeline "<bcc>" & strEmailBCC & "</bcc>"
.writeline "<subject>" & txt_EmailSubject.value & "</subject>"
.writeline "<emailbody>" & txt_EmailBody.value & "</emailbody>"
if chk_selectall.Checked then .writeline "<checkboxes>chk_selectall</checkboxes>"
if chk_seatno.Checked then .writeline "<checkboxes>chk_seatno</checkboxes>"
if chk_building.Checked then .writeline "<checkboxes>chk_building</checkboxes>"
if chk_extensionno.Checked then .writeline "<checkboxes>chk_extensionno</checkboxes>"
if chk_empid.Checked then .writeline "<checkboxes>chk_empid</checkboxes>"
if chk_department.Checked then .writeline "<checkboxes>chk_department</checkboxes>"
if chk_designation.Checked then .writeline "<checkboxes>chk_designation</checkboxes>"
if chk_name.Checked then .writeline "<checkboxes>chk_name</checkboxes>"
if chk_loginname.Checked then .writeline "<checkboxes>chk_loginname</checkboxes>"
if chk_email.Checked then .writeline "<checkboxes>chk_email</checkboxes>"
if chk_notes.Checked then .writeline "<checkboxes>chk_notes</checkboxes>"
if chk_computerserialno.Checked then .writeline "<checkboxes>chk_computerserialno</checkboxes>"
if chk_replacedmachine.Checked then .writeline "<checkboxes>chk_replacedmachine</checkboxes>"
if chk_oupathcomputer.Checked then .writeline "<checkboxes>chk_oupathcomputer</checkboxes>"
if chk_computeros.Checked then .writeline "<checkboxes>chk_computeros</checkboxes>"
if chk_computerdescription.Checked then .writeline "<checkboxes>chk_computerdescription</checkboxes>"
if chk_computercreated.Checked then .writeline "<checkboxes>chk_computercreated</checkboxes>"
if chk_mobileno.Checked then .writeline "<checkboxes>chk_mobileno</checkboxes>"
if chk_company.Checked then .writeline "<checkboxes>chk_company</checkboxes>"
if chk_address.Checked then .writeline "<checkboxes>chk_address</checkboxes>"
if chk_city.Checked then .writeline "<checkboxes>chk_city</checkboxes>"
if chk_state.Checked then .writeline "<checkboxes>chk_state</checkboxes>"
if chk_zipcode.Checked then .writeline "<checkboxes>chk_zipcode</checkboxes>"
if chk_country.Checked then .writeline "<checkboxes>chk_country</checkboxes>"
if chk_homephone.Checked then .writeline "<checkboxes>chk_homephone</checkboxes>"
if chk_manager.Checked then .writeline "<checkboxes>chk_manager</checkboxes>"
if chk_whencreated.Checked then .writeline "<checkboxes>chk_whencreated</checkboxes>"
if chk_oupathuser.Checked then .writeline "<checkboxes>chk_oupathuser</checkboxes>"
if chk_groupmembership.Checked then .writeline "<checkboxes>chk_groupmembership</checkboxes>"
if chk_subordinates.Checked then .writeline "<checkboxes>chk_subordinates</checkboxes>"
.writeline "</root>"
.Close
end with
Set xmlDom = CreateObject("Microsoft.XMLDOM")
XmlDom.async = False
XmlDom.Load(FileName)
xmlDom.Save(FileName)
Set f = Nothing
Set fso = Nothing
Else
SaveAs
End If
End Sub
Sub OpenIt
chk_selectall.Checked = False
chk_seatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_computerserialno.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
xmlDom.load(FileName)
globalStrSearchField = xmlDom.getElementsByTagName("searchfield").item(0).text
globalStrSearchBtnPush = xmlDom.getElementsByTagName("btnpush").item(0).text
txt_EmailTo.value = xmlDom.getElementsByTagName("to").item(0).text
txt_EmailCC.value = xmlDom.getElementsByTagName("cc").item(0).text
strEmailBCC = xmlDom.getElementsByTagName("bcc").item(0).text
txt_EmailSubject.value = xmlDom.getElementsByTagName("subject").item(0).text
txt_EmailBody.value = xmlDom.getElementsByTagName("emailbody").item(0).text
for n = 0 to xmlDom.getElementsByTagName("checkboxes").Length-1
execute(xmlDom.getElementsByTagName("checkboxes").item(n).text & ".checked = True")
next
DisplayTitle
Submit_Form "FileOpen"
End Sub
Sub Open()
on error resume next
Dim oDLG
Set oDLG = CreateObject("MSComDlg.CommonDialog")
if err.number > 0 then
err.clear
oDLG = window.prompt("Please enter the path and file name to open.", "C:\your-query.qry")
if oDLG <> "" then
FileName = oDLG
OpenIt
End If
else
With oDLG
.DialogTitle = "Open"
.Filter = "Query|*.qry|Text Files|*.txt|All files|*.*"
.MaxFileSize = 255
.Flags = .Flags Or &H1000 'FileMustExist (OFN_FILEMUSTEXIST)
.ShowOpen
If .FileName <> "" Then
FileName = .FileName
OpenIt
End If
End With
end if
Set oDLG = Nothing
End Sub
Sub DisplayTitle
If FileName="" Then
document.Title="Default - " & oHTA.ApplicationName
Else
document.Title=FileName & " - " & oHTA.ApplicationName
End If
End Sub
Sub ClickTheSpecialReportButton
Submit_Form("Disabled")
End Sub
Sub SpecialReportNewUsersToday
Clear_Form
txt_whencreated.Value = FormatDateTime(Date(),2)
Detect_Search_Field("txt_whencreated")
Submit_Form("Main")
End Sub
Sub SpecialReportDisabledUsersToday
Clear_Form
txt_whencreated.Value = FormatDateTime(Date(),2)
Detect_Search_Field("txt_whencreated")
Submit_Form("DisabledToday")
End Sub
Sub GetChkProfiles
For Each objOption in lst_ChkProfiles.Options
objOption.RemoveNode
Next
strAnswer = fAppData & "\profile.xml"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If NOT objFSO.FileExists(strAnswer) Then
'Create profile.xml
Set f = objFSO.CreateTextFile(strAnswer,True)
with f
.writeline "<root>"
.writeline "<profile val=""Default"">"
.writeline "<checkboxes val=""chk_selectall"" />"
.writeline "<checkboxes val=""chk_seatno"" />"
.writeline "<checkboxes val=""chk_replacementseatno"" />"
.writeline "<checkboxes val=""chk_building"" />"
.writeline "<checkboxes val=""chk_extensionno"" />"
.writeline "<checkboxes val=""chk_empid"" />"
.writeline "<checkboxes val=""chk_department"" />"
.writeline "<checkboxes val=""chk_designation"" />"
.writeline "<checkboxes val=""chk_name"" />"
.writeline "<checkboxes val=""chk_loginname"" />"
.writeline "<checkboxes val=""chk_email"" />"
.writeline "<checkboxes val=""chk_notes"" />"
.writeline "<checkboxes val=""chk_computerserialno"" />"
.writeline "<checkboxes val=""chk_replacedmachine"" />"
.writeline "<checkboxes val=""chk_oupathcomputer"" />"
.writeline "<checkboxes val=""chk_computeros"" />"
.writeline "<checkboxes val=""chk_computerdescription"" />"
.writeline "<checkboxes val=""chk_computercreated"" />"
.writeline "<checkboxes val=""chk_mobileno"" />"
.writeline "<checkboxes val=""chk_company"" />"
.writeline "<checkboxes val=""chk_address"" />"
.writeline "<checkboxes val=""chk_city"" />"
.writeline "<checkboxes val=""chk_state"" />"
.writeline "<checkboxes val=""chk_zipcode"" />"
.writeline "<checkboxes val=""chk_country"" />"
.writeline "<checkboxes val=""chk_homephone"" />"
.writeline "<checkboxes val=""chk_manager"" />"
.writeline "<checkboxes val=""chk_whencreated"" />"
.writeline "<checkboxes val=""chk_oupathuser"" />"
.writeline "<checkboxes val=""chk_groupmembership"" />"
.writeline "<checkboxes val=""chk_subordinates"" />"
.writeline "</profile>"
.writeline "</root>"
.Close
end with
Set xmlDom = CreateObject("Microsoft.XMLDOM")
XmlDom.async = False
XmlDom.Load(strAnswer)
xmlDom.Save(strAnswer)
End If
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
XmlDom.Load(strAnswer)
Set oNodes = XmlDom.selectNodes("//profile")
for n = 0 to oNodes.length - 1
set newOption = document.createElement("OPTION")
newOption.Text = oNodes(n).selectSingleNode("@val").Text
newOption.Value = oNodes(n).selectSingleNode("@val").Text
lst_ChkProfiles.Add newOption
next
Set f = Nothing
Set objFSO = Nothing
End Sub
Sub lst_chkprofiles_OnChange
chk_selectall.Checked = False
chk_seatno.Checked = False
chk_replacementseatno.Checked = False
chk_building.Checked = False
chk_extensionno.Checked = False
chk_empid.Checked = False
chk_department.Checked = False
chk_designation.Checked = False
chk_name.Checked = False
chk_loginname.Checked = False
chk_email.Checked = False
chk_notes.Checked = False
chk_computerserialno.Checked = False
chk_replacedmachine.Checked = False
chk_oupathcomputer.Checked = False
chk_computeros.Checked = False
chk_computerdescription.Checked = False
chk_computercreated.Checked = False
chk_mobileno.Checked = False
chk_company.Checked = False
chk_address.Checked = False
chk_city.Checked = False
chk_state.Checked = False
chk_zipcode.Checked = False
chk_country.Checked = False
chk_homephone.Checked = False
chk_manager.Checked = False
chk_whencreated.Checked = False
chk_oupathuser.Checked = False
chk_groupmembership.Checked = False
chk_subordinates.Checked = False
strAnswer = fAppData & "\profile.xml"
Set xmlDom = CreateObject("Microsoft.XMLDOM")
xmlDom.async="false"
XmlDom.Load(strAnswer)
Set oNodes = XmlDom.selectNodes("//profile[@val=""" & lst_chkprofiles.Value & """]/checkboxes")
For i = 0 To oNodes.length - 1
execute(oNodes(i).selectSingleNode("@val").Text & ".Checked = True")
Next
'Test to see what lines are hidden and uncheck the boxes
if tr_seatno.classname="HideFromGUI" then chk_seatno.Checked = False
if tr_replacementseatno.classname="HideFromGUI" then chk_replacementseatno.Checked = False
if tr_building.classname="HideFromGUI" then chk_building.Checked = False
if tr_extensionno.classname="HideFromGUI" then chk_extensionno.Checked = False
if tr_empid.classname="HideFromGUI" then chk_empid.Checked = False
if tr_department.classname="HideFromGUI" then chk_department.Checked = False
if tr_designation.classname="HideFromGUI" then chk_designation.Checked = False
if tr_name.classname="HideFromGUI" then chk_name.Checked = False
if tr_loginname.classname="HideFromGUI" then chk_loginname.Checked = False
if tr_email.classname="HideFromGUI" then chk_email.Checked = False
if tr_mobileno.classname="HideFromGUI" then chk_mobileno.Checked = False
if tr_company.classname="HideFromGUI" then chk_company.Checked = False
if tr_address.classname="HideFromGUI" then chk_address.Checked = False
if tr_city.classname="HideFromGUI" then chk_city.Checked = False
if tr_state.classname="HideFromGUI" then chk_state.Checked = False
if tr_zipcode.classname="HideFromGUI" then chk_zipcode.Checked = False
if tr_country.classname="HideFromGUI" then chk_country.Checked = False
if tr_homephone.classname="HideFromGUI" then chk_homephone.Checked = False
if tr_manager.classname="HideFromGUI" then chk_manager.Checked = False
if tr_whencreated.classname="HideFromGUI" then chk_whencreated.Checked = False
if tr_oupathuser.classname="HideFromGUI" then chk_oupathuser.Checked = False
End Sub
Sub AddToCheckboxProfile
strProfileName = window.prompt("Please enter a profile name.", "My profile name")
strAnswer = fAppData & "\profile.xml"
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strAnswer, ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.Readline
strLine = Trim(strLine)
If strLine <> "</root>" Then
strContents = strContents & strLine & vbCrLf
End If
Loop
objFile.Close
Set f = objFSO.OpenTextFile(strAnswer, ForWriting)
with f
.writeline strContents & vbTab & "<profile val=""" & strProfileName & """>"
if chk_selectall.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_selectall"" />"
if chk_seatno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_seatno"" />"
if chk_replacementseatno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_replacementseatno"" />"
if chk_building.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_building"" />"
if chk_extensionno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_extensionno"" />"
if chk_empid.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_empid"" />"
if chk_department.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_department"" />"
if chk_designation.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_designation"" />"
if chk_name.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_name"" />"
if chk_loginname.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_loginname"" />"
if chk_email.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_email"" />"
if chk_notes.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_notes"" />"
if chk_computerserialno.checked then .writeline vbTab & vbTab & "<checkboxes val=""computerserialno"" />"
if chk_replacedmachine.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_replacedmachine"" />"
if chk_oupathcomputer.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_oupathcomputer"" />"
if chk_computeros.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computeros"" />"
if chk_computerdescription.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computerdescription"" />"
if chk_computercreated.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_computercreated"" />"
if chk_mobileno.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_mobileno"" />"
if chk_company.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_company"" />"
if chk_address.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_address"" />"
if chk_city.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_city"" />"
if chk_state.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_state"" />"
if chk_zipcode.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_zipcode"" />"
if chk_country.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_country"" />"
if chk_homephone.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_homephone"" />"
if chk_manager.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_manager"" />"
if chk_whencreated.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_whencreated"" />"
if chk_oupathuser.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_oupathuser"" />"
if chk_groupmembership.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_groupmembership"" />"
if chk_subordinates.checked then .writeline vbTab & vbTab & "<checkboxes val=""chk_subordinates"" />"
.writeline vbTab & "</profile>"
.writeline "</root>"
.close
end with
set newOption = document.createElement("OPTION")
newOption.Text = strProfileName
newOption.Value = strProfileName
lst_ChkProfiles.Add newOption
lst_ChkProfiles.Value = strProfileName
End Sub
Sub AddToQueryBuilder
globalstrQueryBuilder = globalstrQueryBuilder & globalstrSearchField
if NOT chk_qbrecorder.Checked then
msgbox "The query has been added."
end if
End Sub
Sub QueryBuilderRecorder
if chk_qbrecorder.Checked then
msgbox "Query Builder is now recording."
else
msgbox "Query Builder has stopped recording." & vbCrLf & "Click OK to view the combined query."
RunQueryBuilder
end if
End Sub
Sub ViewQueryBuilder
if globalstrQueryBuilder <> "" then
msgbox "(|" & globalstrQueryBuilder & ")"
else
msgbox "There are no stored queries to view."
end if
End Sub
Sub RunQueryBuilder
globalStrSearchField = "(|" & globalstrQueryBuilder & ")"
globalstrSearchBtnPush = "FileOpen"
Submit_Form "FileOpen"
End Sub
Sub ClearQueryBuilder
globalstrQueryBuilder = ""
End Sub
Sub bt2Go_onclick()
'** Declarations:'
Dim OPR, DM, USR, strNTName, strUserDN, strNM, objUser, TNP, DENY, POS, NEG
Dim objNetwork, objShell
'** Objects:'
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Wscript.Shell")
'** User/Domain:'
OPR = objNetwork.UserName
DM = objNetwork.UserDomain & "\"
'** Write username for the user that needs to be enabled or disabled:'
USR = InputBox("Username:", "Enable or Disable Active Directory User", _
"Write Username Here")
if USR = "" then
exit sub
End if
'** Prevent run-time errors:'
On Error Resume Next
'** Declare NameTranslate constants:'
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
'** Combine the user name and domain name:'
strNTName = DM & USR
strNT2 = DM & OPR
'** Translate operator name into DN:'
Set objTrans2 = CreateObject("NameTranslate")
objTrans2.Init ADS_NAME_INITTYPE_GC, ""
objTrans2.Set ADS_NAME_TYPE_NT4, strNT2
strUserDN2 = objTrans2.Get(ADS_NAME_TYPE_1779)
Set objUser2 = GetObject("LDAP://" & strUserDN2)
strUS3 = Mid(strUserDN2,4)
strUS4 = Split(strUS3, ",")
For i = LBound(strUS4) to UBound(strUS4)
strNM2 = strUS4(i)
Exit For
Next
'** Translate name into DN:'
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
'** Do LDAP bind to object:'
Set objUser = GetObject("LDAP://" & strUserDN)
'** Get full name:'
strUS1 = Mid(strUserDN,4)
strUS2 = Split(strUS1, ",")
For i = LBound(strUS2) to UBound(strUS2)
strNM = strUS2(i)
Exit For
Next
'** If no error, enable or disable user:'
If Err = 0 Then
Const ADS_UF_ACCOUNTDISABLE = 2
intUAC = objUser.Get("userAccountControl")
objUser.Put "userAccountControl", intUAC XOR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
If intUAC AND ADS_UF_ACCOUNTDISABLE Then
POS = 1
Else
NEG = 1
End If
Else
objShell.Popup UCase(USR) & " was not found. Please try again.", _
5, "Unknown Username", 48
exit sub
End If
'** If no permission, give message:'
If Err = "-2147024891" Then
DENY = 1
objShell.Popup "You can not enable or disable this user.", _
5, "Permission Denied", 48
exit sub
End If
'** If no error, show result:'
If DENY <> 1 Then
If POS = 1 Then
MsgBox UCase(USR) & " were successfully enabled.", _
64, "User enabled by " & strNM2
End If
If NEG = 1 Then
MsgBox UCase(USR) & " were successfully disabled.", _
64, "User disabled by " & strNM2
End If
End If
End Sub
Sub bt1Go_onclick()
'** Declarations:'
Dim OPR, DM, USR, strNTName, strUserDN, strNM, objUser, TNP, EROR, ABS
Dim objNetwork, objShell, objFSO
'** Objects:'
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'** User/Domain:'
OPR = objNetwork.UserName
DM = objNetwork.UserDomain & "\"
'** Type username for the user that needs password change:'
USR = InputBox("Username:", "Create Temporary Active Directory User Password", _
"Write Username Here")
if USR = "" then
exit sub
End if
'** Prevent run-time errors:'
On Error Resume Next
'** NameTranslate constants:'
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1
'** Combine the user name and domain name:'
strNTName = DM & USR
strNT2 = DM & OPR
'** Translate operator name into DN:'
Set objTrans2 = CreateObject("NameTranslate")
objTrans2.Init ADS_NAME_INITTYPE_GC, ""
objTrans2.Set ADS_NAME_TYPE_NT4, strNT2
strUserDN2 = objTrans2.Get(ADS_NAME_TYPE_1779)
Set objUser2 = GetObject("LDAP://" & strUserDN2)
strUS3 = Mid(strUserDN2,4)
strUS4 = Split(strUS3, ",")
For i = LBound(strUS4) to UBound(strUS4)
strNM2 = strUS4(i)
Exit For
Next
'** Translate username into DN:'
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strNTName
If Err <> 0 Then
ABS = 1
End If
'** Execute if object is found:'
If ABS <> 1 Then
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
'** Do LDAP bind to object:'
Set objUser = GetObject("LDAP://" & strUserDN)
'** Get full name:'
strUS1 = Mid(strUserDN,4)
strUS2 = Split(strUS1, ",")
For i = LBound(strUS2) to UBound(strUS2)
strNM = strUS2(i)
Exit For
Next
'** Assign password and parameters:'
If strNM <> "" Then
TNP = "changeme" & Mid(objFSO.GetTempName,4,4)
objUser.SetPassword TNP
If Err <> 0 Then
EROR = 1
End If
objUser.Put "pwdLastSet", 0
objUser.IsAccountLocked = False
objUser.SetInfo
End If
'** If no error, show new temporary password:'
If EROR <> 1 Then
MsgBox "New temporary password for " & UCase(USR) & " (" & strNM & "):" & _
vbCrLf & vbCrLf & TNP & vbCrLf, 64, "New Password, configured by " & strNM2
End If
End If
'** End if object not found:'
If ABS = 1 Then
MsgBox UCase(USR) & " was not found. Please try again.", _
48, "Unknown Username"
End If
'** If no permission, give message:'
If EROR = 1 Then
MsgBox "You can not change password for this user.", _
48, "Permission Denied"
End If
End Sub
</script>
<STYLE TYPE="text/css">
<!--
body {background-color: menu;color: menutext;}
td {font-family: MS Sans Serif;font-size: 8pt;}
input {font-family: MS Sans Serif;font-size: 8pt;}
button {font-family: MS Sans Serif;font-size: 8pt;}
option {font-family: MS Sans Serif;font-size: 8pt;}
select {font-family: MS Sans Serif;font-size: 8pt;}
.submenu {position:absolute;top=35;
background-color:Menu;
border="1px outset";}
.MenuIn {border:"1px inset";cursor:default;}
.Menuover {border:"1px outset";cursor:default;}
.Menuout {}
.Submenuover {background-color:highlight;color:highlighttext;cursor:default;}
.Submenuout {background-color:Menu;color:MenuText;cursor:default;}
.HideFromGUI {display:none;}
-->
</STYLE>
<body>
<TABLE id=MenuTable height=25><TR>
<TD onclick='ShowSubMenu Me,MyFileMenu'
onmouseover='MenuOver Me,MyFileMenu'
onmouseout='MenuOut Me'> Query </TD>
<TD >|</TD>
<TD onclick='ShowSubMenu Me,MyEditMenu'
onmouseover='MenuOver Me,MyEditMenu'
onmouseout='MenuOut Me'> Reports </TD>
<TD >|</TD>
<TD onclick='ShowSubMenu Me,QueryBuilderMenu'
onmouseover='MenuOver Me,QueryBuilderMenu'
onmouseout='MenuOut Me'> Query Builder </TD>
<TD >|</TD>
<TD > Checkbox Profile <select id="lst_chkprofiles" name="lst_chkprofiles">
</select>
</TD>
<TD onclick='AddToCheckboxProfile'
onmouseover='MenuOver Me,MyFileMenu'
onmouseout='MenuOut Me'> Add current settings to profile</TD>
<TD >|</TD>
<TD onclick="HideMenu" width="100%" border="2"></TD>
</TR></TABLE>
<TABLE ID=MyFileMenu class=submenu style="left=10;display:none;">
<TR><TD onclick="HideMenu:open"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Open</TD></TR>
<TR><TD onclick="HideMenu:save"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save</TD></TR>
<TR><TD onclick="HideMenu:saveAs"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save As</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:window.close"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Quit</TD></TR>
</TABLE>
<TABLE ID=MyEditMenu class=submenu style="left=50;display:none;">
<TR><TD onclick="HideMenu:Email_This_Record"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email This Record</TD></TR>
<TR><TD onclick="HideMenu:Email_All_Records"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email All Records</TD></TR>
<TR><TD onclick="HideMenu:Email_As_Attachment"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Email as Attachment</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:RunScript"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Save to</TD></TR>
<TR><TD><HR></TD></TR>
<TR><TD onclick="HideMenu:ClickTheSpecialReportButton"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> All Disabled Users</TD></TR>
<TR><TD onclick="HideMenu:SpecialReportDisabledUsersToday"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Disabled Users Modified Today</TD></TR>
<TR><TD onclick="HideMenu:SpecialReportNewUsersToday"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> New Users Created Today</TD></TR>
</TABLE>
<TABLE ID=QueryBuilderMenu class=submenu style="left=95;display:none;">
<TR><TD onclick="HideMenu:AddToQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Add recent query to Query Builder</TD></TR>
<TR><TD onclick="HideMenu:QueryBuilderRecorder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Query Builder Recorder<input type="checkbox" id="chk_qbrecorder" name="chk_qbrecorder"></TD></TR>
<TR><TD onclick="HideMenu:ViewQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> View Query Builder</TD></TR>
<TR><TD onclick="HideMenu:RunQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Run Query Builder</TD></TR>
<TR><TD onclick="HideMenu:ClearQueryBuilder"
onmouseover='Submenuover Me'
onmouseout='Submenuout Me'> Clear Query Builder</TD></TR>
</TABLE>
<hr>
<!-- <table><tr><td align="right"><img src="G:\Tools\oemlogo.bmp"></td></tr></table> -->
<table width="100%" border="0" onclick="HideMenu">
<tr>
<td align="left" colspan="2" valign="top">
<table border="0" padding="1">
<tr>
<td>
<fieldset>
<LEGEND>Email Settings</LEGEND>
<table border="0">
<tr><td>To:</td><td><button onclick="ShowDialogTo">Resolve</button></td><td><input type="text" id="txt_EmailTo" name="txt_EmailTo" size="50"><input type="hidden" id="txt_EmailToHidden" name="txt_EmailToHidden" size="50"><br></td></td><td rowspan="4" valign="top">Email Body:</td><td rowspan="3" valign="top"><textarea id="txt_EmailBody" name="txt_EmailBody" rows=5 cols=40></TEXTAREA></td></tr>
<tr><td>CC:</td><td><button onclick="ShowDialogCC">Resolve</button></td><td><input type="text" id="txt_EmailCC" name="txt_EmailCC" size="50"><input type="hidden" id="txt_EmailCCHidden" name="txt_EmailCCHidden" size="50"><br></td></tr>
<tr><td>Email Subject:</td><td></td><td><select id="txt_EmailSubject" name="txt_EmailSubject"></select></td></tr>
</table>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top">
<table border="0">
<tr>
<td>
</td>
<td>
<input type="checkbox" id="chk_selectall" name="chk_selectall" checked=True onclick="vbs:SelectAllCheck">Select/Deselect All
</td>
</tr>
<tr id=tr_seatno>
<td>
Seat No:
</td>
<td>
<input type="checkbox" id="chk_seatno" name="chk_seatno" checked=True><input type="text" size="40" id="txt_seatno" name="txt_seatno" onkeypress="vbs:Detect_Search_Field('txt_seatno')">
</td>
</tr>
<tr id=tr_replacementseatno>
<td>
Replacement Seat No:
</td>
<td>
<input type="checkbox" id="chk_replacementseatno" name="chk_replacementseatno" checked=True><input type="text" size="40" id="txt_replacementseatno" name="txt_replacementseatno">
</td>
</tr>
<tr id=tr_building>
<td>
Building:
</td>
<td>
<input type="checkbox" id="chk_building" name="chk_building" checked=True><input type="text" size="40" id="txt_building" name="txt_building" onkeypress="vbs:Detect_Search_Field('txt_building')">
</td>
</tr>
<tr id=tr_extensionno>
<td>
Extension No:
</td>
<td>
<input type="checkbox" id="chk_extensionno" name="chk_extensionno" checked=True><input type="text" size="40" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Detect_Search_Field('txt_extensionno')">
</td>
</tr>
<tr id=tr_empid>
<td>
Emp ID:
</td>
<td>
<input type="checkbox" id="chk_empid" name="chk_empid" checked=True><input type="text" size="10" id="txt_empid" name="txt_empid" onkeypress="vbs:Detect_Search_Field('txt_empid')">
</td>
</tr>
<tr id=tr_department>
<td>
Department:
</td>
<td>
<input type="checkbox" id="chk_department" name="chk_department" checked=True><input type="text" size="50" id="txt_department" name="txt_department" onkeypress="vbs:Detect_Search_Field('txt_department')">
</td>
</tr>
<tr id=tr_designation>
<td>
Designation:
</td>
<td>
<input type="checkbox" id="chk_designation" name="chk_designation" checked=True><input type="text" size="50" id="txt_designation" name="txt_designation" onkeypress="vbs:Detect_Search_Field('txt_designation')">
</td>
</tr>
<tr id=tr_name>
<td>
User Name:
</td>
<td>
<input type="checkbox" id="chk_name" name="chk_name" checked=True><input type="text" size="40" id="txt_name" name="txt_name" onkeypress="vbs:Detect_Search_Field('txt_name')">
</td>
</tr>
<tr id=tr_loginname>
<td>
Login Name:
</td>
<td>
<input type="checkbox" id="chk_loginname" name="chk_loginname" checked=True><input type="text" size="40" id="txt_loginname" name="txt_loginname" onkeypress="vbs:Detect_Search_Field('txt_loginname')">
</td>
</tr>
<tr id=tr_email>
<td>
Email Address:
</td>
<td>
<input type="checkbox" id="chk_email" name="chk_email" checked=True><input type="text" size="50" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
</td>
</tr>
<tr id=tr_mobileno>
<td>
Mobile Number:
</td>
<td>
<input type="checkbox" id="chk_mobileno" name="chk_mobileno" checked=True><input type="text" size="20" id="txt_mobileno" name="txt_mobileno" onkeypress="vbs:Detect_Search_Field('txt_mobileno')">
</td>
</tr>
<tr id=tr_company>
<td>
Company:
</td>
<td>
<input type="checkbox" id="chk_company" name="chk_company" checked=True><input type="text" size="20" id="txt_company" name="txt_company" onkeypress="vbs:Detect_Search_Field('txt_company')">
</td>
</tr>
<tr id=tr_address>
<td>
Address:
</td>
<td>
<input type="checkbox" id="chk_address" name="chk_address" checked=True><input type="text" size="20" id="txt_address" name="txt_address" onkeypress="vbs:Detect_Search_Field('txt_address')">
</td>
</tr>
<tr id=tr_city>
<td>
City:
</td>
<td>
<input type="checkbox" id="chk_city" name="chk_city" checked=True><input type="text" size="20" id="txt_city" name="txt_city" onkeypress="vbs:Detect_Search_Field('txt_city')">
</td>
</tr>
<tr id=tr_state>
<td>
State:
</td>
<td>
<input type="checkbox" id="chk_state" name="chk_state" checked=True><input type="text" size="20" id="txt_state" name="txt_state" onkeypress="vbs:Detect_Search_Field('txt_state')">
</td>
</tr>
<tr id=tr_zipcode>
<td>
Zip Code:
</td>
<td>
<input type="checkbox" id="chk_zipcode" name="chk_zipcode" checked=True><input type="text" size="20" id="txt_zipcode" name="txt_zipcode" onkeypress="vbs:Detect_Search_Field('txt_zipcode')">
</td>
</tr>
<tr id=tr_country>
<td>
Country:
</td>
<td>
<input type="checkbox" id="chk_country" name="chk_country" checked=True><input type="text" size="20" id="txt_country" name="txt_country" onkeypress="vbs:Detect_Search_Field('txt_country')">
  Must search by 2 letter country code
</td>
</tr>
<tr id=tr_homephone>
<td>
Home Phone:
</td>
<td>
<input type="checkbox" id="chk_homephone" name="chk_homephone" checked=True><input type="text" size="20" id="txt_homephone" name="txt_homephone" onkeypress="vbs:Detect_Search_Field('txt_homephone')">
</td>
</tr>
<tr id=tr_manager>
<td>
Manager:
</td>
<td>
<input type="checkbox" id="chk_manager" name="chk_manager" checked=True><input type="hidden" size="20" id="txt_manager" name="txt_manager"><input type="text" size="20" id="txt_managerseen" name="txt_managerseen" onkeypress="vbs:Detect_Search_Field('txt_managerseen')">
</td>
</tr>
<tr id=tr_whencreated>
<td>
Date Created:
</td>
<td>
<input type="checkbox" id="chk_whencreated" name="chk_whencreated" checked=True><input type="text" size="40" id="txt_whencreated" name="txt_whencreated" onkeypress="vbs:Detect_Search_Field('txt_whencreated')">
</td>
</tr>
<tr id=tr_oupathuser>
<td>
OU Path:
</td>
<td>
<input type="checkbox" id="chk_oupathuser" name="chk_oupathuser" checked=True><input type="text" size="50" id="txt_oupathuser" name="txt_oupathuser" onkeypress="vbs:Detect_Search_Field('txt_oupathuser')">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br>Showing record 
<span id="span_currentrecord">
0
</span>
 of 
<span id="span_totalrecords">
0
</span>
<br>
<input type="button" value='||< First' name='btnFirstEvent' onClick='vbs:First_Event'>     
<input type="button" value='<< Previous' name='btnPreviousEvent' onClick='vbs:Previous_Event'>     
<input type="button" value='Next >>' name='btnNextEvent' onClick='vbs:Next_Event'>     
<input type="button" value='Last >||' name='btnLastEvent' onClick='vbs:Last_Event'><br><br><br>
<input type="button" value='Email this record' name='btnEmailThisRecord' onClick='vbs:Email_This_Record'>     
<input type="button" value='Email all records' name='btnEmailAllRecords' onClick='vbs:Email_All_Records'>     
<input type="button" value='Email as attachment' name='btnEmailAsAttachment' onClick='vbs:Email_As_Attachment'><br><br><br>
<input type="button" value='Clear Form' name='btnClearForm' onClick='vbs:Clear_Form'>
<input type="submit" value="Submit" name="btn_submit" onClick="vbs:Submit_Form('Main')">
<input id="runbutton" class="button" type="button" value="Save to" name="run_button" onClick="Runscript">
<input id="runbutton" class="button" type="button" value="Change User Password" name="bt1go">
<input id="runbutton" class="button" type="button" value="Enable or Disable User" name="bt2go">
</td>
</tr>
</table>
</td>
<td align="left" valign="top">
<fieldset>
<LEGEND><input type="checkbox" id="chk_groupmembership" name="chk_groupmembership" checked=True>Group Membership</LEGEND>
<select size="12" id="lst_groupnames" name="lst_groupnames" onDblClick="vbs:Submit_Form('Group')">
</select>
</fieldset>
<br><br>
<fieldset>
<LEGEND><input type="checkbox" id="chk_subordinates" name="chk_subordinates" checked=True>Subordinates</LEGEND>
<select size="12" id="lst_subordinates" name="lst_subordinates" onDblClick="vbs:Submit_Form('Subordinate')">
</select>
</fieldset>
<br><br>
<fieldset>
<LEGEND>Computer Information</LEGEND>
<table>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="checkbox" id="chk_notes" name="chk_notes" checked=True><input type="text" size="40" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
</td>
</tr>
<tr>
<td>
Serial No:
</td>
<td>
<input type="checkbox" id="chk_computerserialno" name="chk_computerserialno" checked=True><input type="text" size="40" id="txt_computerserialno" name="txt_computerserialno" onkeypress="vbs:Detect_Search_Field('txt_computerserialno')">
</td>
</tr>
<tr>
<td>
Replaced Machine:
</td>
<td>
<input type="checkbox" id="chk_replacedmachine" name="chk_replacedmachine" checked=True><input type="text" size="40" id="txt_replacedmachine" name="txt_replacedmachine">
</td>
</tr>
<tr>
<td>
OU Path:
</td>
<td>
<input type="checkbox" id="chk_oupathcomputer" name="chk_oupathcomputer" checked=True><input type="text" size="40" id="txt_oupathcomputer" name="txt_oupathcomputer" onkeypress="vbs:Detect_Search_Field('txt_oupathcomputer')">
</td>
</tr>
<tr>
<td>
Computer OS:
</td>
<td>
<input type="checkbox" id="chk_computeros" name="chk_computeros" checked=True><input type="text" size="19" id="txt_computeros" name="txt_computeros" onkeypress="vbs:Detect_Search_Field('txt_computeros')">
<input type="text" size="18" id="txt_computerservicepack" name="txt_computerservicepack" onkeypress="vbs:Detect_Search_Field('txt_computerservicepack')">
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<input type="checkbox" id="chk_computerdescription" name="chk_computerdescription" checked=True><input type="text" size="40" id="txt_computerdescription" name="txt_computerdescription" onkeypress="vbs:Detect_Search_Field('txt_computerdescription')">
</td>
</tr>
<tr>
<td>
Created:
</td>
<td>
<input type="checkbox" id="chk_computercreated" name="chk_computercreated" checked=True><input type="text" size="40" id="txt_computercreated" name="txt_computercreated" onkeypress="vbs:Detect_Search_Field('txt_computercreated')">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</body>
ASKER
Thank U.
Below the replacement Machine i want a box for "Serial No"
So totally i have 4 boxes related to new machine and replacement machine and 2 serial no's
Below the replacement Machine i want a box for "Serial No"
So totally i have 4 boxes related to new machine and replacement machine and 2 serial no's
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank U...
ASKER
Here are 2 posts that needs you help... Please take time to have a look...
https://www.experts-exchange.com/questions/23742125/Active-Directory-quering.html
https://www.experts-exchange.com/questions/23742151/ADS-HTA-Querier.html
Thank U
https://www.experts-exchange.com/questions/23742125/Active-Directory-quering.html
https://www.experts-exchange.com/questions/23742151/ADS-HTA-Querier.html
Thank U
ASKER
1.Need a box below seat no same as the Replace machine box New Seat NO
>> I need 4 boxes totally as
Machine Name (From Notes)
Serial No (From Notes) I have a new option added in notes that has the serial no of the machine. Can i get to this box "Header in there is "Serial No :"
Replaced Machine Name (Static will be entered manually if required just for mailing purpose)
Serial No (Static will be entered manually if required just for mailing purpose)