查询打印机服务器以查看是否存在打印机 [英] Query printer server to see if printer exists

查看:260
本文介绍了查询打印机服务器以查看是否存在打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello scriptting friends,

Hello scripting friends,

我正在尝试将网络打印机添加到全局设置到计算机而不是基于用户的计算机上,因此无论用户登录到什么用户那台电脑他们不必添加打印机。 为此,我使用命令提示符运行
rundll32 printui.dll命令。 我们的技术人员将使用此脚本在这些计算机上设置打印机。 我们的技术是这些计算机上的本地管理员,脚本的工作方式是它会打开一个输入框,技术人员会在打印机名称中输入
然后它将运行printui.dll命令并添加打印机。  ;我想要做的是确保在命令运行之前打印机上存在打印机,以防他们用手指键入打印机。 我知道这是
"模型T"脚本所以请耐心等待。 任何帮助表示赞赏!

I'm trying to add network printers to computers that are set globally to the computer instead of being user based so no matter what user logs into that computer they won't have to add the printer.  To do this i was using the command prompt to run the rundll32 printui.dll command.  Our tech's are going to use this script to set up the printers on these computers.  Our tech's are local admin's on these computers and the way the script works is it will bring up a input box and the tech's will type in the printer name then it will run the printui.dll command and add the printer.  What i'm wanting to do is make sure the printer exists on the print server before the command runs just in case they fat finger typing the printer.  I know this is the "model T" of scripts so bear with me.  Any help is appreciated!!

On Error Resume Next
Dim objNet, strPrinter
Set objNet = CreateObject("Wscript.Network")
strPrinter = InputBox("Please enter the name of the Printer you'd like to add", "Add Printer", "eg. printer name")
Set objShell = CreateObject("WScript.Shell")
arrServers = Array("vps01","vps02")
For Each strServer In arrServers
    strCommand = "cmd /c rundll32 printui.dll,PrintUIEntry /ga /n\\" & strServer & "\" & strPrinter
    objShell.Run strCommand, 1, True
Next




推荐答案

使用组策略要容易得多。 这种方法在几年前已被弃用。 管理起来太难了。 组策略将所有打印机部署到所有用户或按组,OU或位置进行部署。

It is far easier to use Group Policy.  This method was deprecated years ago.  It is too hard to manage.  Group Policy will deploy all printers to all users or deploy by group., OU or location.


这篇关于查询打印机服务器以查看是否存在打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆