Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '### For Philip from Darren Collins.
- '=============================
- strNameListFile = "C:\temp\NameList.txt"
- Set fso = CreateObject("Scripting.FileSystemObject")
- strNameList = fso.OpenTextFile(strNameListFile, 1).ReadAll
- arrNameList = Split(strNameList, vbCrlf)
- strComputer = "."
- For Each strPrinterName In arrNameList
- If strPrinterName <> "" Then
- Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
- Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
- objNewPort.Name = strPrinterName
- objNewPort.Protocol = 1
- objNewPort.HostAddress = strPrinterName
- objNewPort.PortNumber = "9100"
- objNewPort.SNMPEnabled = False
- objNewPort.Put_
- End If
- Next
- MsgBox "Script Complete"
- WScript.Quit 0
- '=============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement