域环境中添加网络打印机

最近公司在域中添加了一台网络打印机,当普通域用户添加时,出现被策略阻止,无法安装。通过以下vbs脚本,可以让用户直接添加打印机(只要双击就可以)

On Error Resume Next

dim result, strcomputer, objWshNet, objWMIService, objNetwork, colInstalledPrinters, objPrinter, WshNetwork, bForce
 
 
'* Create instance of wshNetwork object         
Set objNetwork = WScript.CreateObject("WScript.Network")
 
'* substitute your server and printer names
objNetwork.AddWindowsPrinterConnection "\\192.168.1.166\hpb702"
 
'* Set default printer for named users and add additional printers
'* for certain users, set the PHASER2 printer on SERVER-C
'* as the default for all other users                   
'*Select Case objNetwork.UserName
 
objNetwork.SetDefaultPrinter("\\192.168.1.166\hpb702")
 
MsgBox "Your printers have been installed."

你可能感兴趣的:(网络,server,create,打印机,SUBSTITUTE)