公司最近在上AD域,通过域下发vbs脚本实现自动安装网络打印机,不用人工手动给别人安装
Option Explicit
On Error Resume Next
Dim objNetwork, strUNCPrinter, bForce, bUpdateProfile
strUNCPrinter = "\\172.16.1.250\XXX打印机"
bForce = "True"
bUpdateProfile = "False"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.RemovePrinterConnection strUNCPrinter, bForce, bUpdateProfile
objNetwork.AddWindowsPrinterConnection strUNCPrinter
objNetwork.SetDefaultPrinter strUNCPrinter
WScript.Echo "已经添加了打印机:" & strUNCPrinter
Wscript.Quit
strUNCPrinter = “\172.16.1.250\XXX打印机”
这个打印机名字,就是172.16.1.250这个地址下的名字
其他没什么要注意的了