This tip explains how to create printer ports and shared printers programmatically in a clustered environment.
Assumptions:
There are two steps to this process:
- Define printer ports on each node of the cluster.
- Create shared printers on each node of the cluster.
Define printer ports:
NOTE: Printer ports should be defined on each node of the cluster. If you have a range of printers, you may want to manually split the range between the two virtual nodes.
Step1: Use IP.bat to Create portmaker batch file.
Rename IP.txt to Portmaker.bat. This file will be used to create ports on PRINT_NODE1 node of the cluster.
Perform the same process for PRINT_NODE2. Modify IP.bat to reflect the new range of printer ports and PRINT_NODE:
FOR /L %%I IN (128,1,254) DO CALL :TEST %%I
Listing for IP.bat
FOR /L %%I IN (0,1,127) DO CALL :TEST %%I
:TEST
ECHO CALL PORT.BAT 192.168.0.%1 >>IP.TXT
ECHO CALL PORTCREATE.BAT PRINT_NODE1>>IP.TXT.
PORTMAKER.BAT Sample output
CALL PORT.BAT 192.168.0.0
CALL PORTCREATE.BAT PRINT_NODE1
CALL PORT.BAT 192.168.0.1
CALL PORTCREATE.BAT PRINT_NODE1
Port.bat creates the port.ini file that Portcreate.bat uses to apply the registry changes using the Regini Resource Kit utility. Note the GUID.
Requires Free Membership to View
- Each virtual server stores its resources under a different GUID. You will need to verify this manually using REGEDT32.
Listing for Port.bat
echo >port.ini RegistryMachineClusterResources222eca55-e86a-4b3f-9091- c47d6f7ac5e6ParametersMonitorsStandard TCP/IP PortPortsIP_%1
echo >>port.ini HostName = REG_SZ
echo >>port.ini HWAddress = REG_SZ
echo >>port.ini IPAddress = %1
echo >>port.ini PortNumber = REG_DWORD 9100
echo >>port.ini Protocol = REG_DWORD 1
echo >>port.ini SNMP Community = REG_SZ "public"
echo >>port.ini SNMP Enabled = REG_DWORD 1
echo >>port.ini SNMP Index = REG_DWORD 1
echo >>port.ini Version = REG_DWORD 1
Listing for Portcreate.bat
regini -m \%1 port.ini
Creating print shares:
Use the following two batch files to mass-create shared printers. Sample listing of PRINTCREATE.BAT:
CALL DRIVER.BAT 8N7 PRINT_NODE1 192.168.0.1 Xerox Docuprint N32
Listing of Driver.bat
rundll32 printui.dll,PrintUIEntry /if /b "%1" /c \%2 /f %windir% infntprint.inf /r "IP_%3" /m "Xerox Docuprint N32" /h "Intel" /v "Windows NT 4.0 or 2000" /u /Z
rundll32 printui.dll,PrintUIEntry /Xs /c \%2 /n "\%2%1" comment "%4 %5 %6"
rundll32 printui.dll,PrintUIEntry /Xs /c \%2 /n "\%2%1" location "%1"
NOTE: If the driver does not exist on the second node, you can run the following command on the second node to install the driver:
rundll32 printui.dll , PrintUIEntry /id
You may need to stop and start the cluster service on each node to refresh the print queue information held in Active Directory.
This was first published in September 2003
Enterprise Server Strategies for the CIO
Join the conversationComment
Share
Comments
Results
Contribute to the conversation