Advertisement

09.06.2008 at 12:26PM PDT, ID: 23709095
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Hta to get data from ADS need additions

Asked by bsharath in VB Script, Scripting Languages

Tags:

Hi,

Hta to get data from ADS need additions

1. Need a TO box that will get the user name from ADS when put in a name. If left blank then send a mail from the predefined TO in the script.
2. Get the disabled user details. That can be mailed and saved too..
This has to get the disabled users details. Some help here....
DSQuery user -samid * -disabled -limit 0 >C:\DisabledUsers.txt
or
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Q_22621782.html

3. Get the users Manager name in a box.
4. A big box in a side that shows all groups the user is even from the root Domain.

Regards
Sharath
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988:
989:
990:
991:
992:
993:
994:
995:
996:
997:
998:
999:
1000:
1001:
1002:
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012:
1013:
1014:
1015:
1016:
1017:
1018:
1019:
1020:
1021:
1022:
1023:
1024:
1025:
1026:
1027:
1028:
1029:
1030:
1031:
1032:
1033:
1034:
1035:
1036:
1037:
1038:
1039:
1040:
1041:
1042:
1043:
1044:
1045:
1046:
1047:
1048:
1049:
1050:
1051:
1052:
1053:
1054:
1055:
1056:
1057:
1058:
1059:
1060:
1061:
1062:
1063:
1064:
1065:
1066:
1067:
1068:
1069:
1070:
1071:
1072:
1073:
1074:
1075:
1076:
1077:
1078:
1079:
1080:
1081:
1082:
1083:
1084:
1085:
1086:
1087:
1088:
1089:
1090:
1091:
1092:
1093:
1094:
1095:
1096:
1097:
1098:
1099:
1100:
1101:
1102:
1103:
1104:
1105:
1106:
1107:
1108:
1109:
1110:
1111:
1112:
1113:
1114:
1115:
1116:
1117:
1118:
1119:
1120:
1121:
1122:
1123:
1124:
1125:
1126:
1127:
1128:
1129:
1130:
1131:
1132:
1133:
1134:
1135:
1136:
1137:
1138:
1139:
1140:
1141:
1142:
1143:
1144:
1145:
1146:
1147:
1148:
1149:
1150:
1151:
1152:
1153:
1154:
1155:
1156:
1157:
1158:
1159:
1160:
1161:
1162:
1163:
1164:
1165:
1166:
1167:
1168:
1169:
1170:
1171:
1172:
1173:
1174:
1175:
1176:
1177:
1178:
1179:
1180:
1181:
1182:
1183:
1184:
1185:
1186:
1187:
1188:
1189:
1190:
1191:
1192:
1193:
1194:
1195:
1196:
1197:
1198:
1199:
1200:
1201:
1202:
1203:
1204:
1205:
1206:
1207:
1208:
1209:
1210:
1211:
1212:
1213:
1214:
1215:
1216:
1217:
1218:
1219:
1220:
1221:
1222:
1223:
1224:
1225:
1226:
1227:
1228:
1229:
1230:
1231:
1232:
1233:
1234:
1235:
1236:
1237:
1238:
1239:
1240:
1241:
1242:
1243:
1244:
1245:
1246:
1247:
1248:
1249:
1250:
1251:
1252:
1253:
1254:
1255:
1256:
1257:
1258:
1259:
1260:
1261:
1262:
1263:
1264:
1265:
1266:
1267:
1268:
1269:
1270:
1271:
1272:
1273:
1274:
1275:
1276:
1277:
1278:
1279:
1280:
1281:
1282:
1283:
1284:
1285:
1286:
1287:
1288:
1289:
1290:
1291:
1292:
1293:
1294:
1295:
1296:
1297:
1298:
1299:
1300:
1301:
1302:
1303:
1304:
1305:
1306:
1307:
1308:
1309:
1310:
1311:
1312:
1313:
1314:
1315:
1316:
1317:
1318:
1319:
1320:
1321:
1322:
1323:
1324:
1325:
1326:
1327:
1328:
1329:
1330:
1331:
1332:
1333:
1334:
1335:
1336:
1337:
1338:
1339:
1340:
1341:
1342:
1343:
1344:
1345:
1346:
1347:
1348:
1349:
1350:
1351:
1352:
1353:
1354:
1355:
1356:
1357:
1358:
1359:
1360:
1361:
1362:
1363:
1364:
1365:
1366:
1367:
1368:
1369:
1370:
1371:
1372:
1373:
1374:
1375:
1376:
1377:
1378:
1379:
1380:
1381:
1382:
1383:
1384:
1385:
1386:
1387:
1388:
1389:
1390:
1391:
1392:
1393:
1394:
1395:
1396:
1397:
1398:
1399:
1400:
1401:
1402:
1403:
1404:
1405:
1406:
1407:
1408:
1409:
1410:
1411:
1412:
1413:
1414:
1415:
1416:
1417:
1418:
1419:
1420:
1421:
1422:
1423:
1424:
1425:
1426:
1427:
1428:
1429:
1430:
1431:
1432:
1433:
1434:
1435:
1436:
1437:
1438:
1439:
1440:
1441:
1442:
1443:
1444:
1445:
1446:
1447:
1448:
1449:
1450:
1451:
1452:
1453:
1454:
1455:
1456:
1457:
1458:
1459:
1460:
1461:
1462:
1463:
1464:
1465:
1466:
1467:
1468:
1469:
1470:
1471:
1472:
1473:
1474:
1475:
1476:
1477:
1478:
1479:
1480:
1481:
1482:
1483:
1484:
1485:
1486:
1487:
1488:
1489:
1490:
1491:
1492:
1493:
1494:
1495:
1496:
1497:
1498:
1499:
1500:
1501:
1502:
1503:
1504:
1505:
1506:
1507:
1508:
1509:
1510:
1511:
1512:
1513:
1514:
1515:
1516:
1517:
1518:
1519:
1520:
1521:
1522:
1523:
<head>
<title>User Information</title>
<HTA:APPLICATION 
     APPLICATIONNAME="User Information"
     BORDER="thin"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
</head>
 
<script language="VBScript">
 
' Global variables
Dim arrRows
Dim strEmailFrom
Dim strEmailTo
Dim strEmailServer
 
strEmailFrom = "Active Directory Report <Active.Directory@plc.com>"
strEmailTo = GetUsersEmailAddress
strEmailServer = "mailserver"
 
Sub Window_OnLoad
      intWidth = 900
      intHeight = 1000
      Me.ResizeTo intWidth, intHeight
      Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
      btnFirstEvent.Disabled = True
      btnPreviousEvent.Disabled = True
      btnNextEvent.Disabled = True
      btnLastEvent.Disabled = True
      btnEmailThisRecord.Disabled = True
      btnEMailAllRecords.Disabled = True
      btnEmailAsAttachment.Disabled = True
      txt_EmailCC.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"
End Sub
 
Sub Default_Buttons
      If Window.Event.KeyCode = 13 Then
            btn_submit.Click
      ElseIf Window.Event.KeyCode = 27 Then
            Clear_Form
      End If      
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_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_whencreated.Value = ""
      txt_whencreated.style.backgroundColor="#FFFFFF"
      txt_whencreated.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
 
      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_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_whencreated"
                  If txt_whencreated.Value = "" Then
                        strSearchField = "(whenCreated=*)"
                  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 & "115959.0Z)"
                  End If
            Case Else
                  strSearchField = "INVALID"
      End Select
 
      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,whenCreated"
            
            ' 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 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 & strBuilding
                        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|" & strInfo
                                          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("whenCreated").Value
                      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)
                        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_whencreated.Value = arrData(18)
                        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
      Else
            MsgBox "Please type a search request into one of the fields, then click Submit."
      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_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_whencreated.Value = arrData(18)
 
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
            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
            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
            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
            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_mobileno", _
            "txt_company", _
            "txt_address", _
            "txt_city", _
            "txt_state", _
            "txt_zipcode", _
            "txt_country", _
            "txt_homephone", _
            "txt_whencreated" _
      )
      
      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 Location 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
                  Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
            Else
                  Set objFile = objFSO.CreateTextFile(strAnswer, True)
                  objFile.Write """Seat No"",""Building"",""Extension"",""Emp ID"",""Department"",""Designation"",""User Name"",""Login Name"",""Email Address"",""Computer"",""Mobile"",""Company"",""Address"",""City"",""State"",""Zip Code"",""Country"",""Home Phone"",""Date Created"""
            End If
      
                  For intRow = LBound(arrRows) To UBound(arrRows)
                        arrData = Split(arrRows(intRow), "|TD|")
        if chk_seatno.Checked then
		str_seatno      = arrData(0)
	else
		str_seatno      = ""
	end if
 
	if chk_building.Checked then
		str_building    = arrData(1)
	else
		str_building    = ""
	end if
 
	if chk_seatno.Checked then
		str_extensionno = arrData(2)
	else
		str_extensionno = ""
	end if
 
	if chk_empid.Checked then
		str_empid       = arrData(3)
	else
		str_empid       = ""
	end if
 
	if chk_department.Checked then
		str_department  = arrData(4)
	else
		str_department  = ""
	end if
 
	if chk_designation.Checked then
		str_designation = arrData(5)
	else
		str_designation = ""
	end if
 
	if chk_name.Checked then
		str_name        = arrData(6)
	else
		str_name        = ""
	end if
 
	if chk_loginname.Checked then
		str_loginname   = arrData(7)
	else
		str_loginname   = ""
	end if
 
	if chk_email.Checked then
		str_email       = arrData(8)
	else
		str_email       = ""
	end if
 
	if chk_notes.Checked then
		str_notes       = arrData(9)
	else
		str_notes       = ""
	end if
 
	if chk_mobileno.Checked then
		str_mobileno    = arrData(10)
	else
		str_mobileno    = ""
	end if
 
	if chk_company.Checked then
		str_company     = arrData(11)
	else
		str_company     = ""
	end if
 
	if chk_address.Checked then
		str_address     = arrData(12)
	else
		str_address     = ""
	end if
 
	if chk_city.Checked then
		str_city        = arrData(13)
	else
		str_city        = ""
	end if
 
	if chk_state.Checked then
		str_state       = arrData(14)
	else
		str_state       = ""
	end if
 
	if chk_zipcode.Checked then
		str_zipcode     = arrData(15)
	else
		str_zipcode     = ""
	end if
 
	if chk_country.Checked then
		str_country     = arrData(16)
	else
		str_country     = ""
	end if
 
	if chk_homephone.Checked then
		str_homephone   = arrData(17)
	else
		str_homephone   = ""
	end if
 
	if chk_whencreated.Checked then
		str_whencreated = arrData(18)
	else
		str_whencreated = ""
	end if
            objFile.Write VbCrLf & """" & str_seatno & """,""" & str_building & """,""" & str_extensionno & """,""" & str_empid & _
                  """,""" & str_department & """,""" & str_designation & """,""" & str_name & """,""" & str_loginname & _
                  """,""" & str_email & """,""" & str_notes & """,""" & str_mobileno & """,""" & str_company & _
                  """,""" & str_address & """,""" & str_city & """,""" & str_state & """,""" & str_zipcode & _
                  """,""" & str_zipcode & """,""" & str_country & """,""" & str_homephone & """"
            Next
            objFile.Close
            MsgBox "Saved."
      End If
End Sub
 
Sub Email_This_Record
 
	arrData = Split(arrRows(span_currentrecord.InnerHTML - 1), "|TD|")
 
        if chk_seatno.Checked then
		str_seatno      = "Seat No: " & arrData(0) & vbCRLF
	else
		str_seatno      = ""
	end if
 
	if chk_building.Checked then
		str_building    = "Building: " & arrData(1) & vbCRLF
	else
		str_building    = ""
	end if
 
	if chk_seatno.Checked then
		str_extensionno = "Extension No: " & arrData(2) & vbCRLF
	else
		str_extensionno = ""
	end if
 
	if chk_empid.Checked then
		str_empid       = "Emp ID: " & arrData(3) & vbCRLF
	else
		str_empid       = ""
	end if
 
	if chk_department.Checked then
		str_department  = "Department: " & arrData(4) & vbCRLF
	else
		str_department  = ""
	end if
 
	if chk_designation.Checked then
		str_designation = "Designation: " & arrData(5) & vbCRLF
	else
		str_designation = ""
	end if
 
	if chk_name.Checked then
		str_name        = "User Name: " & arrData(6) & vbCRLF
	else
		str_name        = ""
	end if
 
	if chk_loginname.Checked then
		str_loginname   = "Login Name: " & arrData(7) & vbCRLF
	else
		str_loginname   = ""
	end if
 
	if chk_email.Checked then
		str_email       = "Email Address: " & arrData(8) & vbCRLF
	else
		str_email       = ""
	end if
 
	if chk_notes.Checked then
		str_notes       = "Machine Name: " & arrData(9) & vbCRLF
	else
		str_notes       = ""
	end if
 
	if chk_mobileno.Checked then
		str_mobileno    = "Mobile Number: " & arrData(10) & vbCRLF
	else
		str_mobileno    = ""
	end if
 
	if chk_company.Checked then
		str_company     = "Company: " & arrData(11) & vbCRLF
	else
		str_company     = ""
	end if
 
	if chk_address.Checked then
		str_address     = "Address: " & arrData(12) & vbCRLF
	else
		str_address     = ""
	end if
 
	if chk_city.Checked then
		str_city        = "City: " & arrData(13) & vbCRLF
	else
		str_city        = ""
	end if
 
	if chk_state.Checked then
		str_state       = "State: " & arrData(14) & vbCRLF
	else
		str_state       = ""
	end if
 
	if chk_zipcode.Checked then
		str_zipcode     = "Zip Code: " & arrData(15) & vbCRLF
	else
		str_zipcode     = ""
	end if
 
	if chk_country.Checked then
		str_country     = "Country: " & arrData(16) & vbCRLF
	else
		str_country     = ""
	end if
 
	if chk_homephone.Checked then
		str_homephone   = "Home Phone: " & arrData(17) & vbCRLF
	else
		str_homephone   = ""
	end if
 
	if chk_whencreated.Checked then
		str_whencreated = "Date Created: " & arrData(18) & vbCRLF
	else
		str_whencreated = ""
	end if
  
        str_message = str_seatno & _
            str_building & vbCRLF & _
            str_extensionno & _
            str_empid & _
            str_department & _
            str_designation & _
            str_name & _
            str_loginname & _
            str_email & _
            str_notes & _
            str_mobileno & _
            str_company & _
            str_address & _
            str_city & _
            str_state & _
            str_zipcode & _
            str_country & _
            str_homephone & _
            str_whencreated
 
      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 = txt_EmailCC.value
        objMessage.Subject = strEmailSubject
        objMessage.TextBody = 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
'        Set objMessage = Nothing
 
'        Set wshShell = wscript.CreateObject("wscript.shell")
'        wshShell.Run "blat -to your-email@yourdomain.com -subject ""Active Directory Detail Report"" -body """ & str_message & """", 1, True
'        set wshShell = Nothing
 
        MsgBox "An email has been sent"
 
End Sub
 
Sub Email_All_Records
 
        str_message = ""
        for n = 0 to UBound(arrRows)
	   arrData = Split(arrRows(n), "|TD|")
 
        if chk_seatno.Checked then
		str_seatno      = "Seat No: " & arrData(0) & vbCRLF
	else
		str_seatno      = ""
	end if
 
	if chk_building.Checked then
		str_building    = "Building: " & arrData(1) & vbCRLF
	else
		str_building    = ""
	end if
 
	if chk_seatno.Checked then
		str_extensionno = "Extension No: " & arrData(2) & vbCRLF
	else
		str_extensionno = ""
	end if
 
	if chk_empid.Checked then
		str_empid       = "Emp ID: " & arrData(3) & vbCRLF
	else
		str_empid       = ""
	end if
 
	if chk_department.Checked then
		str_department  = "Department: " & arrData(4) & vbCRLF
	else
		str_department  = ""
	end if
 
	if chk_designation.Checked then
		str_designation = "Designation: " & arrData(5) & vbCRLF
	else
		str_designation = ""
	end if
 
	if chk_name.Checked then
		str_name        = "User Name: " & arrData(6) & vbCRLF
	else
		str_name        = ""
	end if
 
	if chk_loginname.Checked then
		str_loginname   = "Login Name: " & arrData(7) & vbCRLF
	else
		str_loginname   = ""
	end if
 
	if chk_email.Checked then
		str_email       = "Email Address: " & arrData(8) & vbCRLF
	else
		str_email       = ""
	end if
 
	if chk_notes.Checked then
		str_notes       = "Machine Name: " & arrData(9) & vbCRLF
	else
		str_notes       = ""
	end if
 
	if chk_mobileno.Checked then
		str_mobileno    = "Mobile Number: " & arrData(10) & vbCRLF
	else
		str_mobileno    = ""
	end if
 
	if chk_company.Checked then
		str_company     = "Company: " & arrData(11) & vbCRLF
	else
		str_company     = ""
	end if
 
	if chk_address.Checked then
		str_address     = "Address: " & arrData(12) & vbCRLF
	else
		str_address     = ""
	end if
 
	if chk_city.Checked then
		str_city        = "City: " & arrData(13) & vbCRLF
	else
		str_city        = ""
	end if
 
	if chk_state.Checked then
		str_state       = "State: " & arrData(14) & vbCRLF
	else
		str_state       = ""
	end if
 
	if chk_zipcode.Checked then
		str_zipcode     = "Zip Code: " & arrData(15) & vbCRLF
	else
		str_zipcode     = ""
	end if
 
	if chk_country.Checked then
		str_country     = "Country: " & arrData(16) & vbCRLF
	else
		str_country     = ""
	end if
 
	if chk_homephone.Checked then
		str_homephone   = "Home Phone: " & arrData(17) & vbCRLF
	else
		str_homephone   = ""
	end if
 
	if chk_whencreated.Checked then
		str_whencreated = "Date Created: " & arrData(18) & vbCRLF
	else
		str_whencreated = ""
	end if
  
        str_message = str_seatno & _
            str_building & vbCRLF & _
            str_extensionno & _
            str_empid & _
            str_department & _
            str_designation & _
            str_name & _
            str_loginname & _
            str_email & _
            str_notes & _
            str_mobileno & _
            str_company & _
            str_address & _
            str_city & _
            str_state & _
            str_zipcode & _
            str_country & _
            str_homephone & _
            str_whencreated & VbCrLf & "--------------------------------" & 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 = txt_EmailCC.value
        objMessage.Subject = strEmailSubject
        objMessage.TextBody = 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
'        Set objMessage = Nothing
 
'        Set wshShell = wscript.CreateObject("wscript.shell")
'        wshShell.Run "blat -to your-email@yourdomain.com -subject ""Active Directory Detail Report"" -body """ & str_message & """", 1, True
'        set wshShell = Nothing
 
        MsgBox "An email has been sent"
 
End Sub
 
Sub Email_As_Attachment
      strAnswer = "D:\HTAResults.csv"
 
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      If objFSO.FileExists(strAnswer) = True Then
            Set objFile = objFSO.OpenTextFile(strAnswer, 8, False)
      Else
            Set objFile = objFSO.CreateTextFile(strAnswer, True)
            objFile.Write """Seat No"",""Building"",""Extension"",""Emp ID"",""Department"",""Designation"",""User Name"",""Login Name"",""Email Address"",""Computer"",""Mobile"",""Company"",""Address"",""City"",""State"",""Zip Code"",""Country"",""Home Phone"",""Date Created"""
      End If
 
            For intRow = LBound(arrRows) To UBound(arrRows)
                  arrData = Split(arrRows(intRow), "|TD|")
 
        if chk_seatno.Checked then
		str_seatno      = arrData(0)
	else
		str_seatno      = ""
	end if
 
	if chk_building.Checked then
		str_building    = arrData(1)
	else
		str_building    = ""
	end if
 
	if chk_seatno.Checked then
		str_extensionno = arrData(2)
	else
		str_extensionno = ""
	end if
 
	if chk_empid.Checked then
		str_empid       = arrData(3)
	else
		str_empid       = ""
	end if
 
	if chk_department.Checked then
		str_department  = arrData(4)
	else
		str_department  = ""
	end if
 
	if chk_designation.Checked then
		str_designation = arrData(5)
	else
		str_designation = ""
	end if
 
	if chk_name.Checked then
		str_name        = arrData(6)
	else
		str_name        = ""
	end if
 
	if chk_loginname.Checked then
		str_loginname   = arrData(7)
	else
		str_loginname   = ""
	end if
 
	if chk_email.Checked then
		str_email       = arrData(8)
	else
		str_email       = ""
	end if
 
	if chk_notes.Checked then
		str_notes       = arrData(9)
	else
		str_notes       = ""
	end if
 
	if chk_mobileno.Checked then
		str_mobileno    = arrData(10)
	else
		str_mobileno    = ""
	end if
 
	if chk_company.Checked then
		str_company     = arrData(11)
	else
		str_company     = ""
	end if
 
	if chk_address.Checked then
		str_address     = arrData(12)
	else
		str_address     = ""
	end if
 
	if chk_city.Checked then
		str_city        = arrData(13)
	else
		str_city        = ""
	end if
 
	if chk_state.Checked then
		str_state       = arrData(14)
	else
		str_state       = ""
	end if
 
	if chk_zipcode.Checked then
		str_zipcode     = arrData(15)
	else
		str_zipcode     = ""
	end if
 
	if chk_country.Checked then
		str_country     = arrData(16)
	else
		str_country     = ""
	end if
 
	if chk_homephone.Checked then
		str_homephone   = arrData(17)
	else
		str_homephone   = ""
	end if
 
	if chk_whencreated.Checked then
		str_whencreated = arrData(18)
	else
		str_whencreated = ""
	end if
            objFile.Write VbCrLf & """" & str_seatno & """,""" & str_building & """,""" & str_extensionno & """,""" & str_empid & _
                  """,""" & str_department & """,""" & str_designation & """,""" & str_name & """,""" & str_loginname & _
                  """,""" & str_email & """,""" & str_notes & """,""" & str_mobileno & """,""" & str_company & _
                  """,""" & str_address & """,""" & str_city & """,""" & str_state & """,""" & str_zipcode & _
                  """,""" & str_zipcode & """,""" & str_country & """,""" & str_homephone & """"
            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 = txt_EmailCC.value
        objMessage.Subject = strEmailSubject
        objMessage.TextBody = "Please view the attachment."
            
        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
'        Set objMessage = Nothing
 
'        Set wshShell = wscript.CreateObject("wscript.shell")
'        wshShell.Run "blat -to your-email@yourdomain.com -subject ""Active Directory Detail Report"" -body """ & str_message & """", 1, True
'        set wshShell = Nothing
        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_seatno.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_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_whencreated.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_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_whencreated.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 & " <" & aRecordset.Fields("mail").Value & ">"
 
End Function
 
Sub ShowDialog
    txt_EmailCC.Value = ShowModalDialog("modaldialog.hta")
End Sub
 
</script>
 
<body STYLE="font:14 pt arial; color:red;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#0000333', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
<table><tr><td align='right'><img src='G:\Tools\oemlogo.bmp'></td></tr></table>     
 <table width='90%' height = '100%' align='center' border='0'>
            <tr>
                  <td align='center' colspan="2">
                        <h3>User Information</h3>
                  </td>
            </tr
            <tr>
                  <td align='center' colspan="2">
                        <table border="0">
                              <tr>
                                    <td colspan=2>
                                         <fieldset>
                                         <LEGEND>Email Settings</LEGEND>
                                         <table border="0">
                                         <tr><td>&nbsp;<button onclick="ShowDialog">Edit CC field</button>&nbsp;</td><td><input type="text" id="txt_EmailCC" name="txt_EmailCC" size="50" onkeypress="vbs:Detect_Search_Field('txt_whencreated')"><br></td></tr>
                                         <tr><td>&nbsp;Email Subject:&nbsp;</td><td><input type="text" id="txt_EmailSubject" name="txt_EmailSubject" size="50" value="Active Directory Detail Report"></td></tr>
                                         </table>
                                         </fieldset>
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          &nbsp;
                                    </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" maxlength="30" 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" maxlength="30" 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" maxlength="25" 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" maxlength="6" 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" maxlength="30" 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" maxlength="50" size="70" 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" maxlength="30" 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" maxlength="30" 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" maxlength="50" size="70" id="txt_email" name="txt_email" onkeypress="vbs:Detect_Search_Field('txt_email')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                         Machine Name:
                                    </td>
                                    <td>
                                          <input type="checkbox" id="chk_notes" name="chk_notes" checked=True><input type="text" maxlength="16" size="20" id="txt_notes" name="txt_notes" onkeypress="vbs:Detect_Search_Field('txt_notes')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Mobile Number:
                                    </td>
                                    <td>
                                          <input type="checkbox" id="chk_mobileno" name="chk_mobileno" checked=True><input type="text" maxlength="14" 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" maxlength="14" 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" maxlength="14" 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" maxlength="14" 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" maxlength="14" 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" maxlength="14" 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" maxlength="14" size="20" id="txt_country" name="txt_country" onkeypress="vbs:Detect_Search_Field('txt_country')">
                                          &nbsp&nbspMust 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" maxlength="14" size="20" id="txt_homephone" name="txt_homephone" onkeypress="vbs:Detect_Search_Field('txt_homephone')">
                                    </td>
                              </tr>
                              <tr>
                                    <td>
                                          Date Created:
                                    </td>
                                    <td>
                                          <input type="checkbox" id="chk_whencreated" name="chk_whencreated" checked=True><input type="text" maxlength="30" size="50" id="txt_whencreated" name="txt_whencreated" onkeypress="vbs:Detect_Search_Field('txt_whencreated')">
                                    </td>
                              </tr>
                              <tr>
                                    <td colspan="2" align="center">
                                          <br>Showing record&nbsp
                                          <span id="span_currentrecord">
                                          0
                                          </span>
                                          &nbspof&nbsp
                                          <span id="span_totalrecords">
                                          0
                                          </span>
                                          <br>
                                          <input type='button' value='||< First' name='btnFirstEvent'  onClick='vbs:First_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='<< Previous' name='btnPreviousEvent'  onClick='vbs:Previous_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Next >>' name='btnNextEvent'  onClick='vbs:Next_Event'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <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'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <input type='button' value='Email all records' name='btnEmailAllRecords'  onClick='vbs:Email_All_Records'>&nbsp&nbsp&nbsp&nbsp&nbsp
                                          <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="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
                                <input id=runbutton  class="button" type="button" value="Save to" name="run_button"  onClick="Runscript">
                                    </td>
                              </tr>
                        </table>
                  </td>
            </tr>
      </table>
 </body>
[+][-]09.07.2008 at 02:54AM PDT, ID: 22410712

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Scripting Languages
Tags: Script
Sign Up Now!
Solution Provided By: rejoinder
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.07.2008 at 03:39AM PDT, ID: 22410814

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.07.2008 at 02:14PM PDT, ID: 22412920

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.07.2008 at 08:20PM PDT, ID: 22414482

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.07.2008 at 08:20PM PDT, ID: 22414483

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.07.2008 at 08:25PM PDT, ID: 22414510

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 10:24AM PDT, ID: 22419498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 11:09AM PDT, ID: 22419898

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 11:21AM PDT, ID: 22420002

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 11:31AM PDT, ID: 22420090

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.08.2008 at 01:19PM PDT, ID: 22421128

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_EXPERT_20070906