使用powershell来更改registry二进制数据

我明白,使用PowerShell可以更改registry值。

例如,在这里: http : //poshcode.org/3504

我们可以像这样设置属性:

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

然而,是否有可能使用PowerShell设置这些二进制值?

在这里输入图像说明

  1. 读取值(一个字节数组)
  2. 修改数组元素
  3. 将字节数组写回注册表项。

这是一个例子:

 $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