Utility that uses the CUserDomainSid class

In the last post, I illustrated a module that retrieves the User, Domain and SID from the Windows System.Management namespace.  In this post, I'm showing a practical application for that module.

This utility can be used if a user finds that access to the system registry or add/remove programs has been accidentally denied.  Of course, this can also be done with a VBS script (run with Wscript.exe).

Potential error messages:

  1. Registry editing has been disabled by your administrator.
  2. Add or Remove Programs has been restricted. Please check with your administrator.

Registry editing has been disabled
Add or Remove Programs restricted

This was created with Visual Studio Standard 2008 and at least .NET 2.0.

using System;
using Microsoft.Win32;
using UserDomainSid; //...from previous post
namespace RegRelease
   class CRegRelease
      public static string GetSid()
         CUdsObj uds = CUserDomainSid.GetUDS();
         return uds.strSID;

      static void Main(string[] args)
         string strSid = GetSid();

            @"HKEY_USERS\" + strSid +
            "DisableRegistryTools", 0, RegistryValueKind.DWord);

            @"HKEY_USERS\" + strSid +
            "NoAddRemovePrograms", 0, RegistryValueKind.DWord);



posted @ Thursday, January 7, 2010 10:53 PM

Comments on this entry:

No comments posted yet.

Your comment:

(not displayed)


Live Comment Preview: