I have a VB Logon script that uses arrays extensively. It works well, no complaints, but I would like to streamline it somewhat. I was thinking that if I could streamline even part of the array dictionary entries/comparison, and put it in a function, it could save many pages of code. Here is where you come in;
I will post here a part of my script that uses the dictionary. Bear in mind I destroy the dictionary and rebuild it in my script over and over. Here is a code snippet;
cName = Array("M5621","M5630","M5640","M5650"_
For Each strName In cName
oNamesDic.Add strName, ""
If oNamesDic.Exists(strComputer) Then
MapPrinter Pserver, "\My_copier_printer"
MapPrinter Pserver, "\my_color_printer"
MapPrinter Pserver, "\My_Backup_Printer"
oNet.SetDefaultPrinter Pserver & "\My_copier_Printer"
I fill the array with computer names from a group of computers, then compare it to the current computer name. If there is a match, I deliver the printer set, if not, I destroy the array (in Cleararray()) and I proceed to fill a new dictionary with more names to compare.
I literally have 5 pages of script that do exactly this, except the number and names of the machines change and of course, the printer delivery. You can see a small function routine could radically change the size of the script Anything you can come up with would be a blessing to me. I appreciate all you could do to steer me in the right direction. Perhaps a better idea than what I am doing? I do have to check 1200 computers and over 200 groups (not AD groups). Each group is checked in this manner.