Вы находитесь на странице: 1из 4

Add Print Model to Comments Field Release Notes

Installation and system requirements........................................................................................ 3 Usage......................................................................................................................................... 3 Sample file doit.bat.................................................................................................................... 4 Limitations................................................................................................................................. 4

Warranty and Licensing


Copyright 2009 Hewlett-Packard Development Company, L.P. Disclaimer Of Warranty and Support THE SOFTWARE AND ANY RELATED DOCUMENTATION ARE PROVIDED "AS IS", WITHOUT WARRANTY OR SUPPORT OF ANY KIND. THE ENTIRE RISK AS TO THE USE, RESULTS AND PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION ARE ASSUMED BY YOU AND THOSE TO WHOM YOU PROVIDE THE SOFTWARE AND DOCUMENTATION. HEWLETTPACKARD COMPANY, HEWLETT-PACKARD DEVELOPMENT COMPANY, AND THEIR AFFILIATES AND SUBSIDIARIARIES HEREBY SPECIFICALLY DISCLAIM ANY AND ALL WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Limitation Of Liability IN NO EVENT SHALL HEWLETT-PACKARD COMPANY, HEWLETT-PACKARD DEVELOPMENT COMPANY OR THEIR AFFILIATES AND SUBSIDIARIARIES BE LIABLE FOR ANY CLAIM, DAMAGES- DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, SPECIAL OR OTHER DAMAGES, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS AND THE LIKE) OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH CLAIM, DAMAGES OR OTHER LIABILITY.

Edition 1, 12 / 2009

Overview Enumerates all the print queues on the server Checks the name of the driver for that queue. If the driver name contains the string HP Universal Printing o Reads the MODEL_NAME from the registry o Outputs a printui.dll command string to concatenate the MODEL_NAME string after any existing comments

Installation and system requirements


This script does not require any special installation. The script does, however, require the Microsoft prnadmin.dll be installed on the system. This dll is part of the Windows 2003 Resource Kit, which is a free download from Microsoft. If you are using AddModelToComments.vbs on a system other than Windows Server 2003, simply copy the dll from the resource kit to the same folder as the script, and register it using the following instructions. 1. Open a command window. 2. from the command line, on 32 bit systems enter regsvr32 prnadmin.dll 2. from the command line, on 64 bit systems enter %windir%\SysWOW64\regsvr32 prnadmin.dll

Usage
This is a two step process. These steps are designed to be run on the server AFTER queues have been upgraded to UPD. 1. Open a command window. 2. from the command line, on 32 bit systems enter cscript /Nologo AddModelToComments.vbs >doit.bat 2. From the command line, on 64 bit systems enter %windir%\SysWOW64\cscript /Nologo AddModelToComments.vbs >doit.bat This will create a batch file named doit.bat in the current directory. This batch file contains all the commands to write the device name to the comments field. 3. The user is advised to open the batch file and inspect it to verify that it will do what is intended on the intended printers. If there are printers on this list that you do not want modified, simply delete those lines from the batch file. 4. Run the batch file doit.bat from the command prompt

Command Line: AddModelToComments [-l?] [-s server] Arguments: -l - put model in location field instead of comments field -r - replace contents instead of concatenate -s - cluster or remote server name -v - verbose mode - list all printers and drivers found -x - execute now instead of creating batch file -? - display command usage Example: AddModelToComments -l -r -s server_name

Sample file doit.bat


The file doit.bat is automatically generated by the AddModelToComments.vbs script and uses the Microsoft printui.dll utility to do the actual work. Printui.dll has its own syntax and parameters and should not be confused with the parameters used to control AddModelToComments.vbs. This file should not be edited by the user under normal circumstances, and should be changed ONLY if the user really knows what they are doing. The syntax of the Microsoft printui.dll utility is documented in the Microsoft PrintUI.DLL User's Guide and Reference available at
http://www.microsoft.com/windowsserver2003/techinfo/overview/printuidll.mspx

rundll32 printui.dll,PrintUIEntry /Xs /n "HP CLJ 3800 upstairs" comment "ArtDepartment HP Color LaserJet 3800"
The batch file runs the printui.dll once for each one of the printers. In this example, the comments field originally contained the string ArtDepartment for this one printer. After doit.bat runs the comments field will be ArtDepartment HP Color LaserJet 3800"

Limitations
The script in its current form will concatenate the device model string to whatever string is currently in the comments field. This may be a concern for the following reasons: If the script is run more than once, then the device model will be appended more than once. There are no checks in the script regarding string length. If the comments field is excessively long to begin with, the device model may be truncated or an error may result.