This project is read-only.

NAME

Get-RegValue

SYNOPSIS

Sets the default value (REG_SZ) of the registry key on local or remote computers.

SYNTAX

Get-RegValue [[-ComputerName] <>] [[-Hive] <>] [-Key] <> [[-Value] <>] [[-Type] <>] [-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

 

-Value <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

 

-Type <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? 5
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

System.Boolean PSFanatic.Registry.RegistryValue (PSCustomObject)

NOTES

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

EXAMPLES

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

C:\PS>Get-RegValue -Key SOFTWARE\Microsoft\PowerShell\1 -Recurse

ComputerName Hive Key Value Data Type
------------ ---- --- ----- ---- ----
COMPUTER1 LocalMachine SOFTWARE\Microsof... Install 1 DWord
COMPUTER1 LocalMachine SOFTWARE\Microsof... PID 89383-100-0001260... String
COMPUTER1 LocalMachine SOFTWARE\Microsof... Install 1 DWord
COMPUTER1 LocalMachine SOFTWARE\Microsof... ApplicationBase C:\Windows\System... String
COMPUTER1 LocalMachine SOFTWARE\Microsof... PSCompatibleVersion 1.0, 2.0 String
COMPUTER1 LocalMachine SOFTWARE\Microsof... RuntimeVersion v2.0.50727 String
(...)


Description
-----------
Gets all values of the PowerShell subkey on the local computer regardless of their type.

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

C:\PS>[Environment]::Is64BitProcess

False

PS> Get-RegValue -Hive LocalMachine -Key SOFTWARE\MyKey -ComputerName Server1 -View Registry64

ComputerName Hive Key Value Data Type
------------ ---- --- ----- ---- ----
Server1 LocalMachine SOFTWARE\MyKey DWord64 100 QWord
Server1 LocalMachine SOFTWARE\MyKey String64 64 String


Description
-----------
This command is using an elevated 32-bit instance of Windows PowerShell to read values 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>"SERVER1" | Get-RegValue -Key SOFTWARE\Microsoft\PowerShell\1 -Type String,DWord -Recurse -Ping

ComputerName Hive Key Value Data Type
------------ ---- --- ----- ---- ----
SERVER1 LocalMachine SOFTWARE\Microsof... Install 1 DWord
SERVER1 LocalMachine SOFTWARE\Microsof... PID 89383-100-0001260... String
SERVER1 LocalMachine SOFTWARE\Microsof... Install 1 DWord
SERVER1 LocalMachine SOFTWARE\Microsof... ApplicationBase C:\Windows\System... String
SERVER1 LocalMachine SOFTWARE\Microsof... PSCompatibleVersion 1.0, 2.0 String
(...)

Description
-----------
Gets all String and DWord values of the PowerShell subkey and its subkeys from remote computer SERVER1, ping the remote server first.

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

C:\PS>Get-RegValue -ComputerName SERVER1 -Key SOFTWARE\Microsoft\PowerShell -Type MultiString -Value t* -Recurse

ComputerName Hive Key Value Data Type
------------ ---- --- ----- ---- ----
SERVER1 LocalMachine SOFTWARE\Microsof... Types {virtualmachinema... MultiString
SERVER1 LocalMachine SOFTWARE\Microsof... Types {C:\Program Files... MultiString

Description
-----------
Gets all MultiString value names, from the subkey and its subkeys, that starts with the 't' letter from remote computer SERVER1.

RELATED LINKS

http://psrr.codeplex.com
Set-RegValue
Test-RegValue
Remove-RegValue

Last edited Jun 11, 2012 at 1:44 PM by Shay, version 3

Comments

NikeG Oct 21, 2014 at 11:54 AM 
Can I catch the output from the -ping parameter in some way, or for that matter catch an error when a connection to remote registry doesnt work. My problem is that I have ping to certain servers in my list but firewall rules prevent me to connect to remote registry. I want to log this in a file.

Line im using now.
$regtime = Get-RegValue -ComputerName $server -Hive LocalMachine -Key 'Software\Policies\Microsoft\Windows\Windowsupdate\AU\' -Value $Timevalue -ErrorAction SilentlyContinue -Ping | select 'Data'