Silverlight, meet Shell.Application

January 01, 2010

Silverlight 4 is coming, and with it a controversial ability to call local automation objects. Below I will review some of the standard automation objects available in Windows that can be used from Silverlight 4.


Shell Automation enables access to features of Windows shell. This includes displaying standard dialogs, arranging windows, starting applications, starting and stopping services, and more.

Probably the most useful function of Shell.Application is ShellExecute. Using ShellExecute, it’s possible to run executable or open or print a document.

dynamic shell = AutomationFactory.CreateObject("Shell.Application");
shell.ShellExecute("notepad.exe", "", "", "open", 1);


Windows Script Host Shell Object provides access to many useful system level functions, most noteworthy being registry access (RegRead, RegWrite, RegDelete), launching executables (Run, Exec), simulated user input (SendKeys).

dynamic wscript = AutomationFactory.CreateObject("WScript.Shell");
string user = (string)wscript.RegRead(


Windows Script Host Network Object provides access to information about network resources, such as network drives and printers as well as user name, domain name, and computer name.


File System Object gives scripting languages an ability to access file system. While Silverlight has a managed version for many functions provided by File System Object, its other functions can still be useful.

Microsoft office applications

All Microsoft Office applications support automation and is primarily the reason for com automation interop’s introduction in Silverlight 4. Version independent program ids follow a simple pattern of (Office Application Name).Application (i.e., Word.Application, Excel.Application, etc). I found another office automation object called OfficeCompatible.Application, but I couldn’t find any useful information regarding its purpose.


Some other standard automation objects worth investigating: Windows Image Acquisition (WIA.DeviceManager, WIA.ImageFile, WIA.ImageProcess), Task Scheduler (Schedule.Service), FaxServer (FaxComEx.FaxServer), IMAPI2, Internet Explorer (InternetExplorer.Application), Shell.Explorer.

Third party applications can also have automation interfaces, like Skype, for example.

If you would like to find more automation objects, try OleView application that comes with Visual Studio. One thing to remember is that not every com object with an IDispatch-based interface can be accessed from Silverlight. Many com objects are ActiveX controls, and require special support from the hosting environment to work. Because Silverlight is not a control host, it will not be able to use ActiveX controls.