By Richard Lane
Terminal Services is the technology behind Remote Desktop and I use it all the time, but this webcast by Bernard Tritsch opened my eyes to what is possible when you take advantage of the Terminal Services API. It turns a popular feature of Windows into a scriptable, programmable component that enables both easy administration and capable custom applications. Tritsch also explains what’s new for Terminal Services in Windows Server 2008. It strikes me that the webcast would be useful both for IT Professionals and for developers, since it covers a variety of coding techniques including scripts, native C code, and programming with the .NET Framework. Although it is rated level 300, it is not too demanding, and anyone with a little knowledge of how to program for Windows will find it easy to follow. The webcast can be streamed online or downloaded, and lasts around 75 minutes.
Developing for Windows Server 2008 Terminal Services

It was clear immediately that the presenter knows the subject backwards. He is an MVP, consultant, and the author of a book on Terminal Services for Microsoft Press.

I could see this would be a comprehensive webcast, covering scripting through WMI, server and client programming, and a thing called Virtual Channels that I admit I knew little about.
Tritsch has a great slide showing the architecture of Terminal Services, which he showed at several points during the webcast. You can create client applications, server applications, or – you guessed – applications with both client and server components.
TIP: Did you know that Terminal Services is used not only for remote desktop, but also in fast user switching, Vista’s meeting space, and XP Media Center Edition?
Tritsch gave a lightning tour of the WMI (Windows Management Instrumentation) provider for Terminal Services. I learned how IT professionals can use this to control and configure Terminal Services with scripts, and how it can also be called from applications.
I saw WMI examples in Visual Basic Script, PowerShell, and C#. I couldn’t help noticing that the PowerShell example was the most concise.
Tritsch went on to explain the C API for server-side coding. Apparently it is a C API because the DLL, WTSAPI32, has been around since NT 4.0. He memorably described the coding approach as “Sandwich” style. Seasoned API coders will know exactly what he means.

Many developers today prefer to use the .NET Framework. Tritsch showed in detail how to create a wrapper class for .NET using platform invoke.

Tritsch moved on to client-side programming, and gave one of the most compelling examples in the webcast: a custom application which embeds a remote desktop through the Terminal Services ActiveX control.
TIP: Beware if you have existing web applications which depend on the Remote Desktop OCX control. This will not be supported in Windows Server 2008, which could break some web pages.

This little message box is more interesting when you realize it is created by a custom application using a key feature of Terminal Services – virtual channels. I did not realize before that this is how things like printer and sound redirection work in Remote Desktop. Apparently Windows Server 2008 extends this by providing dynamic virtual channels, addressing limitations in previous implementations. This is exciting for developers, as it lets custom Terminal Services clients communicate with server components behind the scenes.
I recommend this webcast for anyone working with Terminal Services. Developers will learn the scope of the Terminal Services APIs, while IT Professionals will learn how a little coding or scripting can tailor these services to fit a wide variety of requirements.
TechNet Webcast: Developing for Windows Server 2008 Terminal Services.