Constantine Posted November 27, 2007 Share Posted November 27, 2007 strComputer = "."Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", TrueSet objDriver = objWMIService.Get("Win32_PrinterDriver")objDriver.Name = "SAVIN MLP25n PCL 5e" '<-- Driver name in INF fileobjDriver.SupportedPlatform = "Windows NT x86"objDriver.Version = "3"objDriver.FilePath = "\\255.255.255.255\Printer Script Drivers\Savin MLP25_MLP25N" '<-- Path to inf fileobjDriver.Infname = "\\255.255.255.255\Printer Script Drivers\Savin MLP25_MLP25N\OEMSETUP.INF" '<-- Path and name if inf fileintResult = objDriver.AddPrinterDriver(objDriver)'Installs Printer PortobjNewPort.Name = "IP_255.255.255.255" '<-- change to the port address or nameobjNewPort.Protocol = 1objNewPort.HostAddress = "255.255.255.255" '<-- change to the port address or nameobjNewPort.PortNumber = 9100 '<-- Change to appropriate port number if neededobjNewPort.SNMPEnabled = TrueobjNewPort.Put_'Install PrinterobjPrinter.DriverName = "SAVIN MLP25n PCL 5e" '<-- change to match the driver name in the INF same as first line aboveobjPrinter.PortName = "IP_255.255.255.255" '<-- change to the port address or nameobjPrinter.DeviceID = "Pritner1" '<-- Friendly name displayed in control panelobjPrinter.Location = ""objPrinter.Network = TrueobjPrinter.Put_Here is the code I currently have. It basically install a printer with default settings.What I need is a way to automate which trays are activated on a per printer basis. The options I can think of is adding to this VBS script, or using a batch file. I'd even be willing to use registry settings if that is the best way.Thanks for your input.(I changed the important things to be somewhat private. No I don't use broadcast IP's.) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now