This project is read-only.

NAME

Get-RegKey

SYNOPSIS

Gets the registry keys on local or remote computers.

SYNTAX

Get-RegKey [[-ComputerName] <>] [[-Hive] <>] [-Key] <> [[-Name] <>] [-Ping] [-View] [-Recurse] [<CommonParameters>]

DESCRIPTION

 

PARAMETERS

-ComputerName <String[]>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? 1
Default value $env:COMPUTERNAME
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

 

-Hive <String>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? 2
Default value LocalMachine
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

 

-Key <String>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? true
Position? 3
Default value  
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

 

-Name <String>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? 4
Default value *
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

 

-Ping <SwitchParameter>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false

 

-View <RegistryView>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? named
Default value Default
Accept pipeline input? false
Accept wildcard characters? false

 

-Recurse <SwitchParameter>

Adds a new member even the object has a custom member with the same name. You cannot use the Force parameter to replace a standard member of a type.

Required? false
Position? named
Default value False
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, type,
"get-help about_commonparameters".

INPUTS

 

OUTPUTS

PSFanatic.Registry.RegistryKey (PSCustomObject)

NOTES

Author: Shay Levy
Blog : http://PowerShay.com

EXAMPLES

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

C:\PS>Get-RegKey -Key SOFTWARE\Microsoft\PowerShell\1 -Name p*

ComputerName Hive Key SubKeyCount ValueCount
------------ ---- --- ----------- ----------
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine 0 6
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns 5 0
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PSConfigurationProviders 1 0


Description
-----------
Gets all keys from the PowerShell subkey on the local computer with names starts with the letter 'p'.

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

C:\PS>[Environment]::Is64BitProcess

False

PS> Get-RegKey -Key SOFTWARE -Name MyKey -ComputerName Server1 -View Registry64

ComputerName Hive Key SubKeyCount ValueCount
------------ ---- --- ----------- ----------
Server1 LocalMachine SOFTWARE\MyKey 0 6


Description
-----------
This command is using an elevated 32-bit instance of Windows PowerShell to read keys from
a 64-bit registry section of a remote 64-bit server. First we verify that the current console
is a 32-bit instance by using the Is64BitProcess system environment variable.

Connecting to the 64-bit section of the remote server registry is done using the View
parameter.

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

C:\PS>Get-RegKey -Key SOFTWARE\Microsoft\PowerShell\1 -Name p* -Recurse

ComputerName Hive Key SubKeyCount ValueCount
------------ ---- --- ----------- ----------
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine 0 6
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns 5 0
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\PowerGUI_Pro 0 7
COMPUTER1 LocalMachine SOFTWARE\Microsoft\PowerShell\1\PSConfigurationProviders 1 0

Description
-----------
Gets all keys and subkeys from the PowerShell subkey on the local computer with names starts with the letter 'p'.

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

C:\PS>Get-RegKey -ComputerName SERVER1 -Key SOFTWARE\Microsoft\PowerShell\1 -Name p* | Get-RegValue

ComputerName Hive Key Value Data Type
------------ ---- --- ----- ---- ----
SERVER1 LocalMachine SOFTWARE\Microsof... ApplicationBase C:\Windows\System... String
SERVER1 LocalMachine SOFTWARE\Microsof... PSCompatibleVersion 1.0, 2.0 String
SERVER1 LocalMachine SOFTWARE\Microsof... RuntimeVersion v2.0.50727 String
SERVER1 LocalMachine SOFTWARE\Microsof... ConsoleHostAssemblyName Microsoft.PowerSh... String
SERVER1 LocalMachine SOFTWARE\Microsof... ConsoleHostModuleName C:\Windows\System... String
SERVER1 LocalMachine SOFTWARE\Microsof... PowerShellVersion 2.0 String

Description
-----------
Gets all keys and subkeys from the PowerShell subkey on the remote server SERVER1 with names starts with the letter 'p'.
Pipe the results to Get-RegValue to get all value types under these keys.

RELATED LINKS

http://psrr.codeplex.com
New-RegKey
Remove-RegKey
Test-RegKey

Last edited Jun 11, 2012 at 1:34 PM by Shay, version 2

Comments

No comments yet.