Registry Watcher C#

WMI can sometimes be interesting to work with…I think I understand your question, so take a look at the code snippet below and let me know if it’s what you’re looking for. // ——————————————————————————————————————— // <copyright file=”Program.cs” company=””> // // </copyright> // <summary> // Defines the WmiChangeEventTester type. // </summary> // ——————————————————————————————————————— namespace WmiExample { … Read more

Access Visual Studio 2017’s private registry hive

To manually review, you can use the regedit.exe application to load the privateregistry.bin file by doing the following: Launch RegEdit.exe Select the Computer\HKEY_LOCAL_MACHINE node in the left-hand pane Select the File | Load Hive… menu item, and load the privateregistry.bin When prompted for a key name, just type in something like “VSRegHive” This will load … Read more

How to delete a registry value in C#

To delete the value set in your question: string keyName = @”Software\Microsoft\Windows\CurrentVersion\Run”; using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true)) { if (key == null) { // Key doesn’t exist. Do whatever you want to handle // this case } else { key.DeleteValue(“MyApp”); } } Look at the docs for Registry.CurrentUser, RegistryKey.OpenSubKey and RegistryKey.DeleteValue for more info.

Registering a COM without Admin rights

For what it’s worth, I’ve written a set of C# utilities that register/unregister a .NET type (should be marked as ComVisible of course) in user’s registry without requiring regasm, nor UAC prompts, you can use it like this: // register into current user registry, needs no specific rights ComUtilities.RegisterComObject(ComUtilities.Target.User, typeof(MyClass)); // unregister from user registry, … Read more

Python code to read registry

Documentation says that EnumKey returns string with key’s name. You have to explicitly open it with _winreg.OpenKey function. I’ve fixed your code snippet: from _winreg import * aKey = r”SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) print(r”*** Reading from %s ***” % aKey) aKey = OpenKey(aReg, aKey) for i in range(1024): try: asubkey_name = EnumKey(aKey, i) asubkey … Read more

Command line to remove an environment variable from the OS level configuration

To remove the variable from the current environment (not permanently): set FOOBAR= To permanently remove the variable from the user environment (which is the default place setx puts it): REG delete HKCU\Environment /F /V FOOBAR If the variable is set in the system environment (e.g. if you originally set it with setx /M), as an … Read more

Hand Install of 64-bit MS Access ODBC drivers when 32-bit Office is present

using the /passive switch you can install 64-bit ace drivers even if 32-bit ms office is present: http://blog.codefluententities.com/2011/01/20/microsoft-access-database-engine-2010-redistributable/ Just be warned that installing the 2010 64-bit ACE engine on a machine with 2010 32-bit Office already installed CAN lead to some wacky behavior in your already existing Office 2010.

Script to associate an extension to a program

The real association is stored in the key that “HKEY_CLASSES_ROOT\.xml” points to. On my machine, the default value of that key says “xmlfile”, most likely that is the same for yours. So let’s go to “HKEY_CLASSES_ROOT\xmlfile”. There you can see (and change) what command is going to be used to launch that type of file: … Read more