fbpx View a Registry Key | Windows PowerShell, Windows Server | HostingUltraso.com
24/7/365 Support

View a Registry Key

Problem

You want to view the value of a specific registry key.

Solution

To retrieve the value(s) of a registry key, use the GetItemProperty cmdlet, as shown in Example 181.

Example 181. Retrieving properties of a registry key

PS >SetLocation HKCU: PS >SetLocation \Software\Microsoft\Windows\CurrentVersion\Run PS >GetItemProperty .

PSPath
: Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_U

SER\Software\Microsoft\Windows\CurrentVersion\Run

PSParentPath
: Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_U

SER\Software\Microsoft\Windows\CurrentVersion

PSChildName
: Run

PSDrive
: HKCU

PSProvider
: Microsoft.PowerShell.Core\Registry

FolderShare
: "C:\Program Files\FolderShare\FolderShare.exe" /ba

ckground

TaskSwitchXP
: d:\lee\tools\TaskSwitchXP.exe

ctfmon.exe
: C:\WINDOWS\system32\ctfmon.exe

Ditto
: C:\Program Files\Ditto\Ditto.exe

QuickTime Task
: "C:\Program Files\QuickTime Alternative\qttask.exe

" atboottime

H/PC Connection Agent : "C:\Program Files\Microsoft ActiveSync\wcescomm.exe"

Discussion

In the registry provider, PowerShell treats registry keys as items and key values as properties of those items. To get the properties of an item, use the GetItemProperty cmdlet. The GetItemProperty cmdlet has the standard alias, gp.

Example 181 lists all property values associated with that specific key. To retrieve the value of a specific item, access it as though you would access a property on a .NET object, or anywhere else in PowerShell:

PS >$item = GetItemProperty . PS >$item.TaskSwitchXp d:\lee\tools\TaskSwitchXP.exe

If you want to do this all at once, the command looks like:

PS >$runKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" PS >(GetItemProperty $runKey).TaskSwitchXp d:\lee\tools\TaskSwitchXP.exe

For more information about the GetItemProperty cmdlet, type GetHelp GetItemProperty. For more information about the registry provider, type GetHelp Registry.

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say