Chapter 19. Taming the Windows Registry

In This Chapter

  • Glancing over the registry structure

  • Establishing a connection with the registry

  • Interpreting keys and values

  • Creating keys and values

  • Managing the registry

The heart and soul of Windows is the registry, a centralized repository of configuration information ranging from hardware driver information to application preferences. If you manipulate the registry correctly, you can get Windows and most applications to obey your command, but get it wrong, and you could end up with a system that won't even boot. As long as you stay away from changing things that you don't understand fully, you should be set. Windows PowerShell offers a whole slew of ways you can access and manipulate the Windows registry, and the best part is that it's really easy.

In this chapter, you use both some built-in Cmdlets as well as a .NET class called Microsoft.Win32.RegistryKey to query and manipulate the Windows registry. It's often said that he who masters the Windows registry masters Windows, so having the ability to automate registry changes with a few keystrokes brings you one step closer to reaching that goal.


I haven't been using too many warnings in this book, but this warning is really necessary. Before making any major changes in the Windows registry, make sure that you have it backed up somewhere safe. Making a backup is especially important when you're using scripts to modify the registry, because a problem or flaw in your code could result in ...

Get Windows PowerShell™ 2 For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.