' Survey queue status for every queue on every print server Dim line As String Dim statusReport As String = vbLf & vbLf & "Any problem states are indicated below:" & vbLf & vbLf line = fileOfPrintServers.ReadLine() Do While line IsNot Nothing Dim myPS As New PrintServer(line, PrintSystemDesiredAccess.AdministrateServer) Dim myPrintQueues As PrintQueueCollection = myPS.GetPrintQueues() statusReport = statusReport & vbLf & line For Each pq As PrintQueue In myPrintQueues pq.Refresh() statusReport = statusReport & vbLf & vbTab & pq.Name & ":" If useAttributesResponse = "y" Then TroubleSpotter.SpotTroubleUsingQueueAttributes(statusReport, pq) ' TroubleSpotter class is defined in the complete example. Else TroubleSpotter.SpotTroubleUsingProperties(statusReport, pq) End If Next pq ' end for each print queue line = fileOfPrintServers.ReadLine() Loop ' end while list of print servers is not yet exhausted fileOfPrintServers.Close() Console.WriteLine(statusReport) Console.WriteLine(vbLf & "Press Return to continue.") Console.ReadLine()// Survey queue status for every queue on every print server String line; String statusReport = "\n\nAny problem states are indicated below:\n\n"; while ((line = fileOfPrintServers.ReadLine()) != null) { PrintServer myPS = new PrintServer(line, PrintSystemDesiredAccess.AdministrateServer); PrintQueueCollection myPrintQueues = myPS.GetPrintQueues(); statusReport = statusReport + "\n" + line; foreach (PrintQueue pq in myPrintQueues) { pq.Refresh(); statusReport = statusReport + "\n\t" + pq.Name + ":"; if (useAttributesResponse == "y") { TroubleSpotter.SpotTroubleUsingQueueAttributes(ref statusReport, pq); // TroubleSpotter class is defined in the complete example. } else { TroubleSpotter.SpotTroubleUsingProperties(ref statusReport, pq); } }// end for each print queue }// end while list of print servers is not yet exhausted fileOfPrintServers.Close(); Console.WriteLine(statusReport); Console.WriteLine("\nPress Return to continue."); Console.ReadLine();// Survey queue status for every queue on every print server System::String^ line; System::String^ statusReport = "\n\nAny problem states are indicated below:\n\n"; while ((line = fileOfPrintServers->ReadLine()) != nullptr) { System::Printing::PrintServer^ myPS = gcnew System::Printing::PrintServer(line, PrintSystemDesiredAccess::AdministrateServer); System::Printing::PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues(); statusReport = statusReport + "\n" + line; for each (System::Printing::PrintQueue^ pq in myPrintQueues) { pq->Refresh(); statusReport = statusReport + "\n\t" + pq->Name + ":"; if (useAttributesResponse == "y") { TroubleSpotter::SpotTroubleUsingQueueAttributes(statusReport, pq); // TroubleSpotter class is defined in the complete example. } else { TroubleSpotter::SpotTroubleUsingProperties(statusReport, pq); } } } fileOfPrintServers->Close(); Console::WriteLine(statusReport); Console::WriteLine("\nPress Return to continue."); Console::ReadLine();