6

I understand that with powershell it's possible to change registry values.

for example, here: http://poshcode.org/3504

we can set the properties like this:

Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice' -name ProgId IE.FTP

however, is it possible to set these binary values using powershell??

enter image description here

1 Answer 1

13
  1. Read the value (a byte array)
  2. Modify the array element
  3. Write the byte array back to the registry key.

Here's an example:

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections'

$data = (Get-ItemProperty -Path $key -Name DefaultConnectionSettings).DefaultConnectionSettings
$data[8] = 9
Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data
Sign up to request clarification or add additional context in comments.

3 Comments

this looks amazing!! when you are doing this $data[8] = 9. does this convert 9 to hex?
the byte array is an array of decimal values 0-255. see system.byte. The data is only displayed in base 16 (hex) with the registry editor.
absolutely amazing answer! how did u know how to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.