0

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
seyo -IV
  • 43
  • 7
  • Have you tried [these suggestions](https://superuser.com/questions/595551/how-to-export-a-specific-registry-key-to-a-text-file-using-command-line)? – Gerald Schneider May 07 '19 at 12:25
  • Why would it not work ? It definitely is possible to export one entry with one value. – Overmind May 07 '19 at 12:59
  • Unfortunate this didin't work out for my need. (I mena the SetX thing) @Overmind then how? At least not with the above showed command – seyo -IV May 07 '19 at 13:18
  • So, if you have the values you need in a variable and that's what you need why don't you pipe it to a file? – duenni May 07 '19 at 14:39
  • When you say 'doesn't work', what error do you encounter or what exactly is happening ? – Overmind May 08 '19 at 05:28
  • @Overmind, when I say, e.g., `reg export HKLM\Software\DefaultUserEnvironment\Path test2.reg` I get `ERROR: The system was unable to find the specified registry key or value.` The documentation seems clear enough: you have to specify the name of a key, not the name of a value. The OP wants to export a single value. – Harry Johnston May 08 '19 at 08:02
  • I just tested and it worked fine. Note that if you have any spaces or strange characters, you have to put the whole HKEY thing with double quotes "HKEY\etc\". – Overmind May 08 '19 at 08:15

1 Answers1

2

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
Rajiv Iyer
  • 157
  • 9