Besiktas
Besiktas

Reputation: 331

PowerShell Get-ItemProperty returns wrong binary value

I have a weird issue. I'm trying to get a binary value from the registry and import that value to another computer.

I'm using

$key = "HKCU:\Software\TestKey\001"
(Get-ItemProperty -Path $key)."myValue"

Returns: 68 0 101 0 102 0 97 0 117 0 108 0 116 0 0 0

but the value in registry is: 44 00 65 00 66 00 61 00 75 00 6C 00 74 00 00 00

I've tried almost everything. [System.BitConverter]::ToString() returns the correct value. But when I try to add that back to registry as a binary value, I get an error that it's not in the correct format.

Can someone point out what I'm doing wrong and give me example how to export then import a binary value using Powershell?

Thanks in advance.

Upvotes: 1

Views: 1214

Answers (1)

Prasoon Karunan V
Prasoon Karunan V

Reputation: 3063

You can do it from native command prompt.

reg export /?

Upvotes: 1

Related Questions