System Information From Registry In Silverlight 4


In this article we will see how we can access the registry to see the System Information in Silverlight 4.

Create Silverlight Application

Fire up Visual Studio 2010 and create a Silverlight Application and name the solution as SystemInformationSample.


We should enable the OutOfBrowser mode and enable the Trust level, so that we can access the registry key value.



To Access the COM InteropAutomation Factory we should use the following Namespace.



Now let’s add the Microsoft.CSharp assembly to the project reference so that we can use dynamic programming.



Now let’s have a Button which will display the OS version when it is clicked.



On the click event let’s write down the following code.



As you see in the above code display, we are first checking whether the application is running in OutOfBrowser mode and the application should have Elevated previlage.

Then we are checking whether AutomationFactory is available. If it is available then create an object os the

And finally out of that we would get the registry key value.

Now run the application and install the application on the client machine.



Then click on Install to install it.


Now click the Button and you would get the OS version in a Message Box.



That’s it. You can also try for the following keys to get specific OS related information.


Hope this article helps.