Exploring Registry with PowerShell

01/12/2008

                    
 

                                       
__________________________________________________________________

Welcome to a series of articles on interesting technological topics, the first of which will
discuss PowerShell and Registry.

A lot has been said about PowerShell since early 2007 when the Exchange server was
launched, and even then we saw the strong capabilities of Microsoft’s new Shell
environment.

Before I start reviewing the capabilities of the environment, I wish to explain,
in a few sentences, the environment and command structure.

The PowerShell environment is a command line environment that entails hundreds of
commands that are used to access objects and perform different operations on them.

The advantage of using this environment lies in the simplicity, speed and integration that
it has with the operating system and services (Exchange, Directory Services and more).

Like any environment, each operation that we performed is composed of a verb and a
noun that we perform the operation on, for example:

Get, Set, Sort(verbs) and Service, User, Computer(nouns), meaning that the PowerShell
command effectively looks like this:Get-Service (displays the list of services).

Then, after learning the basic structure of the environment commands, it is possible to
start playing.

It is well known that every operation we perform in the operating system is entered in
the registry, and often we write, delete and retrieve data from it.

Imagine that you could “tour” through the registry as though you were browsing through
folders, or could perform actions of creating and changing entries using the orders that
are used for creating files and folders. So today, you can stop imagining and start doing it!

We shall begin with browsing through the registry branches:

Cd Hklm:   --àmoves to Hklm

PS HKCU:\> Dir Or Ls   ------> List of all of the entries under Hklm



 
We continue by creating entries under current user
 
Cd Hkcu:

PS HKCU:\> Cd Software

PS HKCU:\Software> Md NewInstallation

PS HKCU:\Software> Cd NewInstallation

PS HKCU:\Software \Newinstallation> Md Config




To create entries in the key we created, we shall use the command:

PS HKCU:\Software \Newinstallation\Config> Set-ItemProperty -path "."-name "Authenticationleve" -

value true

An alternative way of creating entries while controlling the entry type is:

PS HKCU:\Software \Newinstallation\Config> New-ItemProperty "."  -name Activepanel  -propertytype

DWord -value 1

To get a list of all of the entries under Hkcu\Software, the following command is used:

PS HKCU:\> Get-Childitem \Software |format-list



 
To perform a specific search just like querying databases, various parameters such as
Include and Exclude are used.

PS HKCU:\Software > gp \* -exclude console

·Gp = Alias for Get-ItemProperty

So this demonstrates that the sky is the limit

Operations may be performed on a remote registry of remote servers, with queries and
so on.

The next article shows an amazing product that allows us to perform all PowerShell
commands and scripts from the GUI. Guess what it's called.....

Correct, PowerGIU, so there is something to look forward to.


 
                                                                      

PrintTell a friendSubmit response
News
SCOM – Check for missing event
(By Snir hoffman)
06/09/2009
See Smart-X IT Software Solutions - Forums
Go to Smart-X IT Software Solutions - Forums . Come to our forum for information, support, and knowledge sharing
בניית אתרים
©Smart-X 2002-2008