设置的是打印服务器上的打印机全名还是共享名称?
WshNetwork.AddWindowsPrinterConnection "\\10.20.2.10\HP5100" 对吗?
Option ExplicitOn Error Resume Next
Dim objNetwork, strUNCPrinter, bForce, bUpdateProfile
strUNCPrinter = "\\ip地址\共享打印机名"
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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)