No announcement yet.

custom paper size and roaming profile on TS servers

  • Filter
  • Time
  • Show
Clear All
new posts

  • custom paper size and roaming profile on TS servers


    I have a Win 2003 R2 terminal server farm that is configured to use roaming profiles. Depending on the printer, I have to use a custom paper size. Right now, when the user logs on the first time I have to log on as administrator and configure their printer: set available paper size in "Device settings" tab, set default paper size on "Advanced" tab -> printing defaults and also on "General" tab -> printing preferences. Because load balancing is used, when the user logs on the second time he might end up on another server. The problem is that every settings are retained EXCEPT default paper size in "General" tab -> printing preferences. The end result is this custom page size has to be manually changed every time and not all users know to do this (or they forget and print invoices using a different paper size)
    My question: how can I make sure that all printer settings are kept when users switch servers? I've tried to use process monitor to see what registry keys are used when default paper size is changed but I couldn't figure out...


  • #2
    Re: custom paper size and roaming profile on TS servers

    Couple of clarification questions:

    Is it a printer installed on the Terminal Server? (Can it be?)
    Does more than one person need different settings? (IE: 1 Person is normal printing, but 1 is special)

    If the printer is on the local machine:
    Does it print correctly before entering the TS?

    Assuming it is a central located printer and not a user printer:
    1) Set the default settings inside the Printer settings on the Terminal (Assuming everyone needs this fix)
    2) Install multiple printers and use AD Groups for permissions so XYZ user only sees the printer with the special paper setting and ABC see alternate setup.



    • #3
      Re: custom paper size and roaming profile on TS servers


      all printers are directly attached to users computers via USB or LAN and are redirected to the terminal server. These users belong to different groups and every group has to use a different custom paper size (I have about 8 groups). Printing works ok, only downside is that everytime the users log on they have to chose default paper size from "General" tab -> printing preferences (the settings for available paper size in "Device settings" tab and default paper size on "Advanced" tab -> printing defaults are kept everytime)


      • #4
        Re: custom paper size and roaming profile on TS servers



        1. you need to download Windows resource kit tools. This is freely
        downloadable. Link

        Have a look at the help file also, in Allprograms-->windows resource kit
        tools->Windows resource kit tools help.html

        2. One of the tools in this took kit is, Setprinter.exe, spooler
        configuration tool

        3. Then I used the following code in VBS to achieve this.
        Dim Wshshell, setpnra3, myprinter
        Set Wshshell= CreateObject("WScript.Shell")
        myprinter = "printer name"
        setpnra3 = "setprinter " &_
        """" & myprinter & """" & " 2 " & """" & "pdevmode=dmpapersize=8" & """"
        ' size = 8 for A3, size 9 for A4 etc.
        intRC = WshShell.Run(setpnra3, 0, TRUE)
        if intRC <> 0 then
        WScript.Echo "Error returned from Setting the Printer " & intRC
        End If
        4. Setprinter.exe can set printer settings to different levels. I have
        used level "2" which has most of the printer settings, in pDevmode.
        Remember, this sets "myprinter" to this new settings.

        5. For the remote printers, if the access is denied, then you can not set
        using this command. Work around to this is, Install the Remote pritner
        locally, to a new local port( there is a procedure in Microsoft web site) and
        then change the settings to this local printer. I have done this way, it
        works fine.

        6. Using this setprinter, you can set most of the printer settings(this is
        not application based, will change the printer settings globally).
        The following can be set:- in pdevmode
        dmorientation = 1 (P) or 2 (L)
        dmpapersize=9(a4), 8(a3)etc
        dmcolor=1monochrome 2 color
        dmduplex=1no.2 yes
        dmTToption=2 (True type fonts)
        dmcollate=1 on 2 off
        dmbitsperpel =4
        dmICMmethod =1
        dmMediatype=1 plain


        If you can test this and let us know we can assist in the next step (use vbs to pull the group from AD and set the default settings based on the group).

        Is the printer that is brought considered the default printer? If so you could gtrab the name in this way:

        strComputer = "." 
        Set objWMIService = GetObject("winmgmts:" _ 
           & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
        Set colInstalledPrinters =  objWMIService.ExecQuery _ 
           ("Select * from Win32_Printer where Default = 'True'") 
        For Each objPrinter in colInstalledPrinters 
           Wscript.Echo "Name: " & objPrinter.Name 
        Last edited by Hobie; 23rd August 2010, 14:40. Reason: Fixed formatting


        • #5
          Re: custom paper size and roaming profile on TS servers

          Good work Hobie
          Best Regards,

          Yuval Sinay

          LinkedIn:, Blog:


          • #6
            Re: custom paper size and roaming profile on TS servers

            Thank you very much.
            I'll try to build a vb script and let you know my findings. My first concern is that if I have to use, for example, pdevmode=dmpapersize=8 for the paper size I want and I'll build another custom paper size is posible that the order will change and dmpapersize=8 would't choose the same paper size... Either way, i'll test it.
            Thanks once again,


            • #7
              Re: custom paper size and roaming profile on TS servers

              Hi everyone,

              just a quick update: as I feared, dmpapersize is SERVER DEPENDENT so I have to figure out the value of every form on every server (right now I have only 4 terminal servers but who knows what the future might bring) Anyway, this is the first solution that works! I've tried to do it from a simple script o a single printer and it worked! I hope the script won't complicate to much as I have to find the user and the right printer (some have 3 or 4 printers that are using, some have the same printer installed twice to use different forms like invoices and recipts). I'll try to add and delete some forms to see what happens. I'll keep you posted.