Add Binary Value to Reg key With Set-Item

Hello I am trying to add website to iE10 Compatibility view

here is what i have so far

$key  = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft"

if(-Not (Test-Path "$key\Internet Explorer")) {
    New-Item -Path $key -Name "Internet Explorer" | Out-Null

if(-Not (Test-Path "$key\Internet Explorer\BrowserEmulation")) {
    New-Item -Path "$key\Internet Explorer" -Name "BrowserEmulation" | Out-Null

if(-Not (Test-Path "$key\Internet Explorer\BrowserEmulation\PolicyList")) {
    New-Item -Path "$key\Internet Explorer\BrowserEmulation" -Name "PolicyList" | Out-Null

$domains = @("","")

$regkey = "$key\Internet Explorer\BrowserEmulation\PolicyList"

foreach($domain in $domains) {
        New-ItemProperty -Path $regkey -Name $domain -Value $domain -PropertyType String | Out-Null

any help would be greatly appreciated

It would be useful to know what you need help with, more specifically. It’s a little difficult to kinda stare at your existing code and understand what you are having problems with.

I am trying to add Google to the compatibility view in ie10 thru the registry using powershell Any suggestions?

Well, without knowing what is, or is not, working, I don’t have any suggestions, no. You appear to be using the correct syntax to modify the registry, but you didn’t mention if you’re getting any errors or if the code simply isn’t doing what you want.

Does the script work? Meaning, does it successfully add the keys you are looking to add?

It creates the Key but adding the Binary value of the key is the issue. When i export the key i get this

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\ClearableListData]

I need to be able to convert the hex to binary in order to use the Set-Item cmdlet, like this

Set-ItemProperty -Path . -Name Test -Value ([byte[]](0x33,0x32,0xFF))

not quite sure how to do that part yet

Did some digging around, could you use this key instead? It uses group policy instead so it’s easier to manage.

HKCU\Software\Policies\Microsoft\Internet Explorer\BrowserEmulation\PolicyList

Add a new string value for a website with the same data and it will make that site run in compatibility mode.



This policy setting allows you to add specific sites that must be viewed in Internet Explorer 7 Compatibility View.

If you enable this policy setting, the user can add and remove sites from the list, but the user cannot remove the entries that you specify.

If you disable or do not configure this policy setting, the user can add and remove sites from the list.