域環境中添加網絡打印機

最近公司在域中添加了一臺網絡打印機,當普通域用戶添加時,出現被策略阻止,無法安裝。通過以下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."

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章