Ghost21 Posted November 1, 2010 Share Posted November 1, 2010 I'm trying to get the printers from each server and list them in a treeview. The problem is for some reason when I do the orginal $aPrintQueues = _AD_ListPrintQueues() The data in the second col. isn't sorted which is a problem and isn't. It isn't a problem if someone can show me how to search just the server that the printer is on and not all of them for a duplicat. As Duplicate can be on more then one machine but not on the same server. ??? expandcollapse popupFunc _AD_ListPrinter() $AD_Printer_TreeViewItem = "" $SamePrintServer = "" $b = "" _AD_Open() $aPrintQueues = _AD_ListPrintQueues() For $i = 1 To $aPrintQueues[0][0] $a = $aPrintQueues[$i][1] If $b <> $a Then $b = $a $PrintServer = StringSplit($aPrintQueues[$i][1], ".") $AD_PrintServer = StringUpper($PrintServer[1]) $hItem = _GUICtrlTreeView_FindItem($TreeView2, $AD_PrintServer, True, 0) If $hItem <> "" Then Else _GUICtrlTreeView_Add($TreeView2, $AD_PrintServer, StringStripWS($AD_PrintServer, 3)) msgbox(0,"Print Server",$AD_PrintServer) EndIf $hItem = "" $Printers = _AD_ListPrintQueues($PrintServer[1]) For $ii = 1 To $Printers[0][0] $AD_Printer = $Printers[$ii][0] $hItem = _GUICtrlTreeView_FindItem($TreeView2, $AD_PrintServer, True, 0) If $hItem <> "" Then _GUICtrlTreeView_AddChild($TreeView2, $hItem, StringStripWS($AD_Printer, 3)) msgbox(0,"Printer",$AD_Printer) Else EndIf $AD_Printer = "" Next $ii = "" $Printers = "" Else EndIf $Percent = Round((100 * $aPrintQueues[0][0]) / 100) $Percent = _Min(_Max(1, $Percent), 99) GUICtrlSetData($Progress1, $Percent) $AD_PrintServer = "" $hItem = "" Next _AD_Close() GUICtrlSetData($Progress1, 0) EndFunc ;==>_AD_ListPrinter HELP !!! Link to comment Share on other sites More sharing options...
water Posted November 2, 2010 Share Posted November 2, 2010 If you know on which spool server the printer queue is defined then you can pass the server name as a parameter to _AD_ListPrintQueues. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now