Windows Registry – How to Export a Single Entry

command-line-interfacepowershellwindows-registry

Is this posssible? For example i have a entry with the Name "DefaultProfile" and the Value "test". How can i export only this one entry not the full tree?

I was thinking about somethign like reg export HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles\DefaultProfile

But this doesen't work.

I have managed to write a script to at least read the entry for further use. My code:

$query = reg query HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\ /f DefaultProfile /s
[array]$rest = $query | select -first 3
$rest -split " " | Select -last 1

Best Answer

You can use Get-ItemProperty to get the name and value of a Registry Key.

Working with Registry Entries

Get-ItemProperty

Sample Code:

Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine | Select PowerShellVersion