Tuesday, March 25, 2008

Logon (printer) scripts

I did some work on using logon scripts to map network printers the other day, but it's time to implement it. I normally set student security restrictions so they cannot add/delete printers, but they nonetheless inevitably get deleted or something.
Something like this:
(fyi, '::' comments out vb lines)

[x.bat]
net use s: \\server\share
::\\server\SHARE(sysvol for simplicity)\test2.vbs
\\server\SHARE(sysvol for simplicity)\test.vbs

[test.vbs]
Option Explicit
Dim netPrinter, UNCpath
UNCpath = "\\server\printer share name (Printer properties --> Share tab"
Set netPrinter = CreateObject("WScript.Network")
netPrinter.AddWindowsPrinterConnection UNCpath
::WScript.Echo "Your printer is mapped from : " & UNCpath
WScript.Quit

I comment out the Echo because students don't need to know where the printer is mapping from. Does anyone?
Regardless, this way, printers can be added even with gp saying otherwise. Rock on.

No comments: