Creating printer ports and shared printers in a clustered environment

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.

Assumptions:

  • 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

    :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

      By submitting your registration information to SearchWindowsServer.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWindowsServer.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

    • 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

    Join the conversationComment

    Share
    Comments

      Results

      Contribute to the conversation

      All fields are required. Comments will appear at the bottom of the article.

      Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.