I use the following script (in a start up file) to automatically find local printers and share them when a user logs onto a terminal server (MS Terminal Server 2003). I need to be able to make this script also disable bidirectional support for these printers without affecting the settings on the local machine.
Does anyone know how I would go about this?
I've searched all over the internet and couldn't find anything similar. I also don't really know any VB, although I have some programming experience. Sorry if I sound dumb. Any help is appreciated.
Code:'strComputer = "." 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objWMIService = GetObject("winmgmts:\\.\root\cimv2") 'WScript.Sleep 5000 'Wait 5 seconds to ensure no errors occur Set colPrinters = objWMIService.ExecQuery _ ("Select * From Win32_Printer Where (DeviceID like 'an%') or (DeviceID like 'cc%') or (DeviceID like 'me%') or (DeviceID like 'ta%')") '"Or DeviceID like '%'" This can be added at the end of the above string for when we have printers that start with something other than "an". For Each objPrinter in colPrinters If (not (objPrinter.Shared)) Or (objPrinter.ShareName <> left(objPrinter.DeviceID,7)) Then objPrinter.Shared = TRUE objPrinter.ShareName = left(objPrinter.DeviceID,7) objPrinter.Put_ End If Next


Reply With Quote