remus 0 Posted June 1, 2011 Hi all, I'd like to create a script that checks to see if a shared printer is available. For example, in a computer class room, as each student turns on their computer, the script will run from startup folder and give the student a breif message about the printers status, if its turned ect. any suggestions welcome. Share this post Link to post Share on other sites
wakillon 403 Posted June 1, 2011 May be you'll be more lucky than me, this vbscript adaptation return always "idle" status, shared printer connected or not ! $_strComputer = @ComputerName ; "." $_objWMIService = ObjGet ( "winmgmts:{impersonationLevel=impersonate}!\\" & $_strComputer & "\root\cimv2" ) $_colInstalledPrinters = $_objWMIService.ExecQuery ( "Select * from Win32_Printer" ) For $_objPrinter in $_colInstalledPrinters ConsoleWrite ( "+->-- Name : " & $_objPrinter.Name & @Crlf ) ConsoleWrite ( "+->-- Location : " & $_objPrinter.Location & @Crlf ) Switch $_objPrinter.PrinterStatus Case 1 $_strPrinterStatus = "Other" Case 2 $_strPrinterStatus = "Unknown" Case 3 $_strPrinterStatus = "Idle" Case 4 $_strPrinterStatus = "Printing" Case 5 $_strPrinterStatus = "Warmup" EndSwitch ConsoleWrite ( "-->-- Printer Status : " & $_strPrinterStatus & @Crlf ) ConsoleWrite ( "-->-- Server Name : " & $_objPrinter.ServerName & @Crlf ) ConsoleWrite ( "-->-- Share Name : " & $_objPrinter.ShareName & @Crlf ) Next AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites