How to set a binary registry value (REG_BINARY) with PowerShell RRS feed

  • Question

  • Hi Scripting Guys!
    see  you again  this time i have got a new problem about setting  a binary registry value (REG_BINARY) with PowerShell
    in some case  i want to add a Compatibility site list in IE 11 ,and i have got  the registry path and ItemProperty
    but the PropertyType is Binary, how to set a binary value
    for example the Compatibility site list is ; 
    here is the  incomplete script  how can i perfection it to translate $site_list into $Value

    $site_list = " ;"
    $registry_path = "HKCU:\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData"
    if(!(Test-Path -Path $registry_path)) {new-Item -Path $registry_path -Verbose -Force}
    Set-ItemProperty -Path $registry_path -name UserFilter  -PropertyType Binary  -Value $Value -Force -Verbose
    Get-ItemProperty -Path $registry_path -Verbose

    Tuesday, May 19, 2020 11:49 AM


All replies

  • The binary value is a string represented in binary.  You have to get the string and convert that to a binary array.

    Here is some info on the format of these entries and how they can be created.


    • Marked as answer by badacook Saturday, May 23, 2020 2:02 AM
    Tuesday, May 19, 2020 1:23 PM
  • thank very  much  jrv 
    Wednesday, May 20, 2020 12:17 AM
  • Hi jrv 
    Recently  i have deployed win10 with a boot script to add a site list to compatibility view setting as your guidance above
    But this settings always be reset and the Compatibility site list always be removed 
    My Windows version is Windows 10 professional 1909 ,and the default browser is Microsoft Edge
    reference to Microsoft  documents "Make Microsoft Edge the default browser" i have made IE instead to be  the default browser
    but when i add some Compatibility site list setting with script  it always effective temporarily but been reset after refresh 
    so i come here for help once again

    Finally  i have find the reason of this issue 
    it is because the " Delete browsing history on exit' setting would erase the compatibility site list
    If clearing browsing history is a requirement and keeping compatibility site list also is necessary 
    have any other way to solve this problem 

    • Edited by badacook Saturday, May 23, 2020 2:57 AM
    Saturday, May 23, 2020 2:06 AM