Articles

Mapping any RDP printer in Terminal Services w/ REDMON

I have always felt that RDP printer mapping within Windows Terminal Services has been much more difficult than it should be. Especially since articles I have read from Microsoft and other sources in the past do not recommend using ANY third party printer drivers on your terminal server. These articles claim that third party printer drivers are the #1 cause for blue screen situations on a terminal server. As a result, I would often try to find a “compatible” driver in the existing Windows printer list. Sometimes I simply could not get a printer to work within a terminal server session.

This article demonstrates how to map ANY working client printer within a terminal server session. Although I would still recommend settling on a compatible driver when possible (ie: Use “HP LaserJet 1100” driver on both ends if you have an LJ 1200), this method allows black and white (and possibly color) printing on any working client printer from within an RDP session.

Setup the printer on the client and confirm it is working by printing a test page. This article assumes the printer is working properly on the client computer. You can use any driver you need to at this point. The driver does not need to be supported by Windows Terminal Server!

We are going to setup a generic postscript printer on the client that accepts jobs and then prints them to the desired destination printer using a combination of RedMon, Ghostscript, and GSview. Once this is working, we can easily configure the terminal server to recognize this postscript printer.

Download and install the most recent version of AFPL Ghostscript and GSview available for your client computer. Make note of the installation directory you use for GSview (usually c:\program files\ghostgum\gsview\gsprint.exe). The default install options are sufficient. At the time of this article, I used AFPL Ghostscript 8.54 Win32 and GSview 4.8 Win32 on a Windows XP SP2 client.

Download and install the most recent version of RedMon – Redirection Port Monitor. This will add a “Redirected Port” to the list of port types you see when you try to add a new printer port to your computer. No install options are presented when you run SETUP.EXE. At the time of this article, I used RedMon 1.7 Win32 on a Windows XP SP2 client.

Create a new printer on the Windows client. After you click “Add a Printer”, choose “Local Printer” (do not auto detect), then choose “Create a new port” (type of port: Redirected Port, port name: use the default), then choose the “Apple LaserWriter II NT v47.0” printer driver, then name the printer “Terminal Services Printer”. Do not make this your default printer. Do not print a test page (yet).

Now we need to install the same driver to your server. We will create an identical printer (on a fake/unused port) and then remove the printer. You may be asked if you want to remove the printer drivers from the terminal server. Be sure to answer NO, because we will need to keep the drivers! Once these drivers are available on the terminal server, automatic printer mapping can occur for any client that is using the exact same driver.

Create a new printer on the Windows Terminal Server. Use the same method and same driver as described for the Windows client (above). It is extremely important that the driver shown in the “Advanced” printer properties tab is IDENTICAL on the client and server, otherwise automatic printer mapping will not occur. If the LaserWriter driver mentioned above is not available on both systems, find/use another common PostScript driver that is available on both systems.

Now that your generic postscript printer has been created on the client and on the server, we need to configure the Redirected Port on the Windows client. Open the properties window for this new printer, then click “Configure Port” on the Ports tab. Redirect this port to the program gsprint.exe (located in c:\program files\ghostgum\gsview\gsprint.exe). Arguments for this program should be simlar to the following example. The printer name provided must EXACTLY match the name of the destination printer! Very important! The “-color” parameter would allow color printing in this particular example (assuming the printer was capable of printing in color). And the final dash “-” is REQUIRED or else the postscript data will not be received by gsprint.exe.

-printer “HP DeskJet 720C Series” -color –

The default settings for the other options will usually work fine. The “Output” default setting should be “Program handles output”. The “Printer” setting is unused/unavailable in this configuration. As a personal preference, I change the “Run” option from NORMAL to HIDDEN so that the GhostScript window does not appear. I also enable the “Run as User” option so that I am prompted for a filename if I send jobs to my local PDF writer. The shutdown delay could be increased from 300 seconds if you find that it takes more than five minutes for your computer to redirect an incoming job to the destination printer.

At this point, you should be able to print a test page through this new postscript printer. The test page should be redirected to your destination printer driver and successfully printed on your printer. If it is not, review your settings and/or review instructions for Emulating a PostScript printer on a Windows host. This article is partially based on instructions from that page.

Attempt to login to the Windows Terminal Server with your RDP client. If the local postscript printer does not appear (pre-Windows 2003 client?), the local RDP client is preventing redirection because it does not recognize the port type. You can resolve this problem by forcing the client to redirect all ports. You should add a DWORD value named “FilterQueueType” with value “FFFFFFFF” to “HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default\AddIns\RDPDR”. Refer to Microsoft Knowledgebase Article # Q302361 for more information regarding this configuration update.

2006/07/20 – Jason Klein

Using Sprint PCS internet (PPP) via Samsung SPH-A680 w/ USB cable

If you use Sprint PCS and you have a Samsung SPH-A680 handset, you can likely use your phone to dialin to the Internet from anywhere you receive a reasonable (2-4 bars) Sprint PCS signal. Depending on your account, your usage may be unmetered (ie: vision plan) or may consume minutes as if the connection were any other phone call. I can receive SMS (text) messages while I am dialed into the Internet through my handset, but I cannot make calls or send SMS messages. You only need to install the necessary driver and dial into the Sprint PCS PPP phone number (see below).

First, you will need to purchase a compatible USB cable (generic) at your local Radio Shack for $10-20. When you connect the phone to your system, Windows XP will fail to locate a compatible driver. I managed to find a driver (9x,NT,2k,XP) that works with the Samsung SPH-A680. Download and extract samsung-sph-a680-usb-drivers.zip, then point the hardware detection wizard toward the extracted files. Windows XP users may receive a warning that their driver is not signed. This is normal and can be ignored.

You do not need to install a proprietary dialer. Once the phone is recognized by Windows as a USB modem, create a new PPP dialup internet connection that uses this modem and dial into “#777” (#ppp) with any username and password. This Sprint PCS dialup number does not seem to require authentication.

While connected to the internet through my Sprint PCS phone, I experienced 300-400ms ping times to google.com. Although I did not run any type of bandwidth tests, my max throughput seemed to range from 32-64k (seemed comparable to 33.6k – 56k dialup).

2006/06/26 – Jason Klein

Configuring MEGARAID driver in CentOS4 kernel to support Dell PERC2/SC and PERC2/DC

This article describes how I successfully installed CentOS4 on a Dell PowerEdge with a PERC2/SC (or PERC2/DC) hardware SCSI RAID controller. The Kernel bundled with CentOS4 uses a newer megaraid_mbox module that no longer includes support for these older Dell PERC-2 (ie: LSI Megaraid 467) controllers. First, you begin by building a “megaraid.ko” module for each kernel you will use (ie: UP/uniprocessor, SMP/multiprocessor). Then you install CentOS4 using the UP module. After installation, you configure CentOS4 to use the MP module.

Building the MEGARAID.ko Kernel Module

You may be able to skip this section by using the files I built. If these files do not work, you will need to build your own kernel modules. You will need to extract each file with bunzip2. [megaraid.ko] [megaraid.ko.smp]

Temporarily setup CentOS4 on another computer. You should only use RPMs from the CD, so that the module you build is compatible with the installation Kernel provided on the CD. In addition to the bare bones installation, you will need the following RPMs:

[sourcecode language=”bash”]
gcc-3.4.4-2.i386.rpm
cpp-3.4.4-2.i386.rpm
glibc-devel-2.3.4-2.13.i386.rpm
glibc-headers-2.3.4-2.13.i386.rpm
glibc-kernheaders-2.4-9.1.98.EL.i386.rpm

kernel-devel-2.6.9-22.EL.i686.rpm

kernel-smp-2.6.9-22.EL.i686.rpm
kernel-smp-devel-2.6.9-22.EL.i686.rpm
[/sourcecode]

Compile the UP (uniprocessor) “megaraid.ko” module first. You will download and extract the source for this module (local copy of megaraid.tar.bz2). Then you will compile the module for use with the 2.6.9-11.EL kernel. Afterwards, you must format a floppy disk and copy the new file to floppy (for use later).

[sourcecode language=”bash”]
cd /opt
wget http://www.tuxyturvy.com/files/megaraid2.tar.bz2

mkdir /usr/src/megaraid
cd /usr/src/megaraid
tar jxvfp /opt/megaraid2.tar.bz2

make -C /lib/modules/2.6.9-11.EL/build SUBDIRS=/usr/src/megaraid modules

fdformat /dev/floppy
mkdosfs /dev/floppy

mkdir /mnt/floppy
mount /dev/floppy /mnt/floppy

cp megaraid.ko /mnt/floppy/
umount /mnt/floppy
[/sourcecode]

Compile the SMP (multiprocessor) “megaraid.ko” module next. You will compile the module for use with the 2.6.9-11.ELsmp kernel. You should also copy this module to floppy (as a separate file name).

[sourcecode language=”bash”]
mkdir /usr/src/megaraid-smp
cd /usr/src/megaraid-smp
tar jxvfp /opt/megaraid2.tar.bz2

make -C /lib/modules/2.6.9-11.ELsmp/build SUBDIRS=/usr/src/megaraid-smp modules

cp megaraid.ko megaraid.ko.smp

fdformat /dev/floppy
mkdosfs /dev/floppy

mkdir /mnt/floppy
mount /dev/floppy /mnt/floppy

cp megaraid.ko.smp /mnt/floppy
umount /mnt/floppy
[/sourcecode]

Manually Loading the MEGARAID.ko Kernel Module

Now you are ready to begin installation of CentOS4 on your Dell PowerEdge system with the unsupported PERC2/SC or PERC2/DC raid controller. When you first boot the CD, type “linux noprobe” to avoid automatic hardware detection. Otherwise, the system will automatically load the (wrong) “megaraid_mbox” module.

[sourcecode language=”bash”]
linux noprobe
[/sourcecode]

When you choose CDROM install, you may receive an error telling you “no cdrom found”. You will need to load the module for the CDROM’s SCSI (or IDE) controller. In our case, we loaded driver “aic7xxx” for our SCSI controller. You should also load your network driver while you can. In our case, we loaded the “3c59x” driver.

Now we will manually load the “megaraid.ko” driver from our floppy disk. Follow the instructions below, starting with CTRL-ALT-F2 to change to a shell prompt.

[sourcecode language=”bash”]
CTRL-ALT-F2
mkdir /mnt/floppy
mount /dev/fd0 /mnt/floppy
insmod /mnt/floppy/megaraid.ko
CTRL-ALT-F1
[/sourcecode]

You can now continue with your installation. The OS will be able to see and partition the volume(s) configured on your PERC2 SCSI raid controller. You must manually install the module BEFORE you press the reboot button at the end of the installation!

Manually Installing the MEGARAID.ko Module

First we will install the UP (uniprocessor) module for use with the 2.6.9-22.EL kernel. We start by switching to a shell console, then copy the “megaraid.ko” module from our floppy to the hard disk. Afterwards, we update modprobe.conf and build a new initial ramdisk image for this kernel.

[sourcecode language=”bash”]
CTRL-ALT-F2
cp /mnt/floppy/megaraid.ko /mnt/sysimage/lib/modules/2.6.9-22.EL/kernel/drivers/scsi/megaraid.ko
chroot /mnt/sysimage
cp /etc/modprobe.conf /etc/modprobe.conf.orig
vi /etc/modprobe.conf
diff /etc/modprobe.conf /etc/modprobe.conf.orig
4c4
< alias scsi_hostadapter1 megaraid --- > alias scsi_hostadapter1 megaraid_mbox

cd /boot
/sbin/mkinitrd initrd-2.6.9-22.EL.img.megaraid 2.6.9-22.EL
cp initrd-2.6.9-EL.img initrd-2.6.9-EL.img.orig
cp initrd-2.6.9-22.EL.img.megaraid initrd-2.6.9-EL.img
exit
CTRL-ALT-F1
[/sourcecode]

Then we will install the MP (multiprocessor) module for use with the 2.6.9-22.ELsmp kernel using a similar method.

[sourcecode language=”bash”]
CTRL-ALT-F2
cp /mnt/floppy/megaraid.ko.smp /mnt/sysimage/lib/modules/2.6.9-22.ELsmp/kernel/drivers/scsi/megaraid.ko
chroot /mnt/sysimage
cp /etc/modprobe.conf /etc/modprobe.conf.orig
vi /etc/modprobe.conf
diff /etc/modprobe.conf /etc/modprobe.conf.orig
4c4
< alias scsi_hostadapter1 megaraid --- > alias scsi_hostadapter1 megaraid_mbox

cd /boot
/sbin/mkinitrd initrd-2.6.9-22.ELsmp.img.megaraid 2.6.9-22.ELsmp
cp initrd-2.6.9-ELsmp.img initrd-2.6.9-ELsmp.img.orig
cp initrd-2.6.9-22.ELsmp.img.megaraid initrd-2.6.9-ELsmp.img
exit
CTRL-ALT-F1
[/sourcecode]

Now the UP and SMP kernels have been configured with the new (old) “megaraid.ko” module! You should be able to boot from both of these modules with support for your PERC2/SC or PERC2/DC controller!

2006/05/18 – Jason Klein