Author: Ron Ratzlaff (aka “The_Ratzenator”)

Date: 6/22/2014

Get-RegKeyandValues PowerShell Tool Help File

The help information provided below can also be viewed by using the following syntax:

Get-HelpGet-RegKeyandValues–Full

Help Info

NAME

Get-RegKeyandValues

SYNOPSIS

The "Get-RegKeyandValues" function will attempt to retrieve Registry keys

and values that you specify, if they exist

SYNTAX

Get-RegKeyandValues [[-ComputerName] <Object>] [-RegHive] <String[]>

[-RegKey] <String[]> [[-GetRegKeyVals] <String[]>] [[-GetRegSubKeys]

<String[]>] [<CommonParameters>]

DESCRIPTION

PARAMETERS

-ComputerName <Object>

A mandatory parameter used to query a single computer or multiple

computers.

Required? false

Position? 1

Default value $env:COMPUTERNAME

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

-RegHive <String[]>

A mandatory parameter used to query one of the primary Registry Hives

(HKCR, HKCU, HKLM, HKU, and HKCC). You must specify one of the primary

Registry Hives as shown below, or an error will display:

HKCR: HKEY_CLASSES_ROOT

HKCU: HKEY_CURRENT_USER

HKLM: HKEY_LOCAL_MACHINE

HKU: HKEY_USERS

HKCC: HKEY_CURRENT_CONFIG

Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

-RegKey <String[]>

A manadatory parameter used to query a specified key. A path must be

specified for the key. For instance, to query the "Uninstall" key

located under HKLM, you will need to specify the following path:

"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

Required? true

Position? 3

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false

-GetRegKeyVals <String[]>

An optional parameter (not mandatory) that retrieves the values listed

within the specified Registry Key parameter (-RegKey) that when used,

requires that either a "Yes" or a "No" value is specified

Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false

-GetRegSubKeys <String[]>

An optional parameter (not mandatory) that retrieves the sub keys

listed within the specified Registry Key parameter (-RegKey) that when

used, requires that either a "Yes" or a "No" value is specified

Required? false

Position? 5

Default value

Accept pipeline input? false

Accept wildcard characters? false

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer and OutVariable. For more information, see

about_CommonParameters

(

INPUTS

OUTPUTS

------EXAMPLE 1 ------

C:\PS>To get the values and the sub keys within the "MyRegKey" key on the

local computer, use the following syntax:

Get-RegKeyandValues -RegHive "HKLM" -RegKey "SOFTWARE\MyRegKey"

-GetRegKeyVals "Yes" -GetRegSubKeys "Yes"

------EXAMPLE 2 ------

C:\PS>To get the values, but exclude the sub keys within the "MyRegKey"

key on the local computer, use the following syntax:

Get-RegKeyandValues -RegHive "HKLM" -RegKey "SOFTWARE\MyRegKey"

-GetRegKeyVals "Yes" -GetRegSubKeys "No"

------EXAMPLE 3 ------

C:\PS>To get the sub keys, but exclude the values within the "MyRegKey"

key on the local computer, use the following syntax:

Get-RegKeyandValues -ComputerName "Computer1" -RegHive "HKLM" -RegKey

"SOFTWARE\MyRegKey" -GetRegKeyVals "No" -GetRegSubKeys "Yes"

------EXAMPLE 4 ------

C:\PS>To retrieve the Registry info remotely on more than one computer,

you can use an array as shown in the following syntax:

Get-RegKeyandValues -ComputerName @("Computer1", "Computer2") -RegHive

"HKLM" -RegKey "SOFTWARE\Wow6432Node" -GetRegKeyVals "Yes" -GetRegSubKeys

"Yes"

------EXAMPLE 5 ------

C:\PS>To retrieve the Registry info remotely on more than one computer,

you can use a file (.csv, .txt) and use the Get-Content cmdlet as shown in

the following syntax:

Get-RegKeyandValues -ComputerName (Get-Content -Path

"$env:TEMP\ComputerList.txt") -RegHive "HKLM" -RegKey

"SOFTWARE\Wow6432Node" -GetRegKeyVals "Yes" -GetRegSubKeys "Yes"

RELATED LINKS