I have been working on a Terminal Server 2008 project that will provide application availability to a number of external companies.

As I normally work on projects internally in our company I usually have full control and a good insight into clients connecting to the services. However with this project the external clients are not managed by me.

One of the issues we have been seeing is that a number of clients where unable to print even though the great new Easyprint feature is on by default. As you can read on Kurt’s blog there are a few pre-requisites to using Easyprint (http://trycatch.be/blogs/roggenk/archive/2007/10/22/windows-server-terminal-services-2008-easy-print.aspx)

The RDP client requires MSTSC version 6.1 and .NET Framework 3.0 SP1 for Easyprint to work . If you want more info on the architecture behind Easyprint check Kurt’s blog at http://trycatch.be/blogs/roggenk/archive/2007/10/24/windows-server-terminal-services-2008-easy-print-how-does-it-work.aspx

As it’s difficult to instruct client to tell you what version of RDP and .NET they have I wrote a little VBS script to check Easyprint compatibility that can be freely distributed to the clients for quick troubleshooting.

The output will look like this and if an error is detected it will give you more info on exact versions it encountered.

image

Now don’t watch the versions too much on this screenshot as they are the actual version you require but i upped the version numbers in the check for this screenshot.

image

'==========================================================================
' AUTHOR: Tom Decaluwé
' DATE  : 06/08/2009
'
' Subject: Check for Easyprint Functionality => requires RDP 6.1 and .net framework 3.0
'
'==========================================================================
'some variables we will be using
strComputer = "."
Const HKEY_LOCAL_MACHINE = &H80000002
StrDotNetCheck = "0"
StrMstscNetCheck = "0"

'get the file version of MSTSC
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where name = 'C:\\Windows\\System32\\mstsc.exe'")
For Each objFile in colFiles
    StrMstcVersion = objFile.Version
Next
'Convert MSTSC version to a number
IntMstcVersion = FormatNumber(Replace (left(StrMstcVersion,3),".",","),1)
'check if the version number is 6.1 or higher
If IntMstcVersion >= 6.1 Then
    StrMstscNetCheck = "1"
End if

'enumerate the .NET versions via the registry
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\.NETFramework"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
    'only enumerate the keys with a version number
    If InStr (subkey,"v") Then
        'create a big string with all versions
        StrNetVerSub =  StrNetVerSub & " | " & subkey
        'convert the current enumerated version to a number
        IntNetVersion = FormatNumber(replace(right(Left(subkey,4),3),".",","),1)
            'check if the .NET version number is 3.0 or higher
            If IntNetVersion >= 3.0 Then
                StrDotNetCheck = "1"
            End if
    End If
Next

'check if both MSTSC and .NET are the same version
If StrMstscNetCheck = "1" And StrDotNetCheck = "1" Then
WScript.Echo "OK: This client is Easyprint compliant for terminal server 2008. (MSTC version > 6.1 | DotNetFramework > 3.0)"

Else
    'check if MSTSC is out of sync
    If StrMstscNetCheck <> "1" And StrDotNetCheck = "1" Then
        WScript.Echo "ERROR: RDP version out of sync: " & StrMstcVersion
     End If
     'check if .NET is out of sync
     If StrMstscNetCheck = "1" And StrDotNetCheck <> "1" Then
        WScript.Echo "ERROR: .NetFramework version out of sync: " & StrNetVerSub
     End If
    'check if both versions are out of sync
    If StrMstscNetCheck <> "1" And StrDotNetCheck <> "1" Then
        WScript.Echo "ERROR: Both out of sync: MCSTS.EXE verision: " & StrMstcVersion & " | " & ".NetFramework Version: " & StrNetVerSub
     End If
End If