#123033 - 2004-07-1505:49 PMSet Local Printer As Default
Richie19Rich77Richie19Rich77
Seasoned Scripter
Registered: 2002-08-16
Posts: 624
Loc: London, England
Hi All
Within my Master Login Script I set local printer as default if found, but for some reason it is not working when loggin on, works fine if I run script after I logon,
Looks like Windows will set the default printer if one is not set after a ammount of idle time, the question is can you set a local printer to be default ???
#123037 - 2004-07-1508:22 PMRe: Set Local Printer As Default
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11629
Loc: CA
As I'm sure you're aware supporting a LOCAL printer for one person is NOT cost effective at all. Unless a user has some very confidential data they print regularly we do not allow local printers. All printers are made Networked printers. In fact we typically will even make the "secured" printer Networked and control access to it.
In the long run it makes mangement much easier then when supported as a stand alone printer.
Registered: 2001-10-10
Posts: 208
Loc: Bristol, England
Found the script useful, I have some usb printers, so changed it to reflect this. I also have a shared printer off my server which is a usb, so needed to set default printer to the first one detected.
I have one question, I would like to detect when the printer is active (Not greyed out) before setting to default. I have a number of laptops that connect to the network that may have numerious local printers setup.
How would this be detected?
_________________________
I want to share something with you - the three sentences that will get you through life. Number 1, 'cover for me.' Number 2, 'oh, good idea, boss.' Number 3, 'it was like that when I got here'.
Registered: 2001-10-10
Posts: 208
Loc: Bristol, England
I'm a complete novice when it comes to wmi, found this code snippet:
Code:
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer") For Each objPrinter in colInstalledPrinters Wscript.Echo "Name: " & objPrinter.Name Wscript.Echo "Location: " & objPrinter.Location Select Case objPrinter.PrinterStatus Case 1 strPrinterStatus = "Other" Case 2 strPrinterStatus = "Unknown" Case 3 strPrinterStatus = "Idle" Case 4 strPrinterStatus = "Printing" Case 5 strPrinterStatus = "Warmup" Case 6 strPrinterStatus = "case 6" Case 7 strPrinterStatus = "offline" End Select Wscript.Echo "Printer Status: " & strPrinterStatus Wscript.Echo "Server Name: " & objPrinter.ServerName Wscript.Echo "Share Name: " & objPrinter.ShareName Wscript.Echo Next
But it does not detect if the local printer or network printers are offline, it just says they are idle?
_________________________
I want to share something with you - the three sentences that will get you through life. Number 1, 'cover for me.' Number 2, 'oh, good idea, boss.' Number 3, 'it was like that when I got here'.
Registered: 2001-10-10
Posts: 208
Loc: Bristol, England
Found some c# which detects USB and parallel : {Link]
Expect you know C# Richard? Wonder if it works though?
_________________________
I want to share something with you - the three sentences that will get you through life. Number 1, 'cover for me.' Number 2, 'oh, good idea, boss.' Number 3, 'it was like that when I got here'.
I have a something similar situation: We have local USB-Printer and parallel-Printer and more networkprinter. I need a kix-script that search the localprinter (first USB, then LPT), an set this as the defaultprinter. if no localprinter is available, than i will define one of the networkprinter.