Debug MMC SnapIns

Create MMC SnapIns as per any of the previous article. Install the Snap-Ins using the InstallUtil utility. Create a .msc file with the new snapin as below. choose File, Save and save the console configuration to a file called Hello.msc under your project's folder:

Change the project debug settings as per this screen. Back in Visual Studio, go to the project properties. On the tab Debug enter the path to mmc.exe (in the system32 folder) and specify the relative path (starting from bin\Debug) to Hello.msc created in the previous step for the command-line arguments. Debug the Application by pressing F5 key.

You may see this screen on Vista, If you did not start Visual Studio elevated

Elevation is needed because you're about to debug something with more privileges and rights (running under SYSTEM after all). Choose Restart under different credentials and accept the UAC prompt. Visual Studio will come back in the same project but you'll have to repeat the previous steps to attach the debugger. Notice the user name is now displayed in the dialog.

You should see the Administrator previlage on the Visual Studio IDE title.

Keep the break points where ever you want and start debugging the application . Here we go, we are done