Problem solve Get help with specific problems with your technologies, process and projects.

Creating printer ports and shared printers in a clustered environment

This tip explains how to create printer ports and shared printers programmatically in a clustered environment.

This tip explains how to create printer ports and shared printers programmatically in a clustered environment.


  • Kerberos support for the cluster has been enabled for each clustered resource as per: PSS ID Number: 235529
  • Access to Resource Kit Utility REGINI

    There are two steps to this process:

    1. Define printer ports on each node of the cluster.
    2. 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

    ECHO CALL PORT.BAT 192.168.0.%1 >>IP.TXT

    PORTMAKER.BAT Sample output


    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. 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 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.

  • Dig Deeper on Windows Server deployment

    Start the conversation

    Send me notifications when other members comment.

    Please create a username to comment.