Archive for February, 2012

Add printer with vbscript and enable snmp on tcp port

I like using VB Script to automate tasks and use them on logon scripts.

strComputer = "."
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")

‘Install TCP/IP Port :

Set objNewPort = objWMIService.Get(“Win32_TCPIPPrinterPort”).SpawnInstance_

objNewPort.Name = “IP_192.168.1.10” ‘Change to TCP/IP port name you want created.
objNewPort.Protocol = 2
objNewPort.HostAddress = “” ‘ Change to the ip address of the printer or the hostname
objNewPort.PortNumber = “515” ‘ Change to the port number normally 9100 or 515 for brother printers
objNewPort.Queue = “BINARY_P1” ‘ Change to Queue name
objNewPort.SNMPCommunity = “public” ‘ Normally just public
objNewPort.SNMPEnabled = True

‘Stop Spooler Service

Set colServiceList = objWMIService.ExecQuery _
(“Select * from Win32_Service where Name=’Spooler'”)
For Each objService In colServiceList
errReturn = objService.StopService()
WScript.Sleep 5000

‘Start Spooler Service

For Each objService In colServiceList
errReturn = objService.StartService()
WScript.Sleep 5000

‘Install Driver :

objWMIService.Security_.Privileges.AddAsString “SeLoadDriverPrivilege”, True

Set objDriver = objWMIService.Get(“Win32_PrinterDriver”)
objDriver.Name = “Brother MFC-6490CW Printer” ‘ Change to the driver name that matches INF file
objDriver.SupportedPlatform = “Windows NT x86”
objDriver.Version = “3”
objDriver.FilePath = “s:\printer\” ‘ Path to the print drivers
objDriver.InfName = “s:\printer\brprbh97.inf” ‘ Path to the INF file
intResult = objDriver.AddPrinterDriver(objDriver)

‘Install TCP-Printer :

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\” & strComputer & “rootcimv2”)

Set objPrinter = objWMIService.Get(“Win32_Printer”).SpawnInstance_

objPrinter.DriverName = “Brother MFC-6490CW Printer” ‘ Must match driver name
objPrinter.PortName = “IP_192.168.1.10” ‘ Must match port name created above
objPrinter.DeviceID = “Brother MFC-6490CW Printer” ‘What ever you want to name the printer
objPrinter.Network = True
objPrinter.Shared = False
objPrinter.ShareName = “”
objPrinter.Published = False
objPrinter.Location = “A3 Printer Upstairs” ‘Location of the printer


Posted in: Blog

Leave a Comment (0) →

How to Change TeamViewer ID after cloning

If you’ve cloned a machine that already has team viewer installed, the clone will have the same ID as the source machine.  Each machine needs it’s own unique ID.  To get the clone to pick up a new ID by deleting 2 registry keys, ClientIC and ClientID.

for 64 bit Windows 7 I found the key here…
for 32 bit Windows 7 and XP the keys are here…

This won’t work on the source machine.  The calculation that determines the ID uses hardware identifiers which haven’t changed and TeamViewer will therefore produce the same ID as before.




Posted in: Blog

Leave a Comment (6) →