Thursday, December 8, 2022

PowerShell 008 - Add registry items and Extension-based Edge IE mode Compatibility

Add registry items and Extension-based Edge IE mode Compatibility


    I recently had to find a way to make Microsoft Visio Viewer, an old Internet Explorer add-on, work on a computer that no longer has IE on it. Microsoft offered a registry fix to allow the file extension to run through Edge IE Mode, and I took that into PowerShell with the resulting code below. Originally I tried to use variables, but ran into issues and ended up hard coding the paths, names, and values. This is the first time I used PowerShell to add registry items, and I used New-Item to generate new paths (folders/subfolders) and New-ItemProperty to add new keys. I also piped the results into Out-Null to remove the output spam. After some experimenting I believe this can be applied to any file extension type, however there might be other prereqs to making other file extensions work. This fix for example below requires the Visio Viewer software to be installed first. To apply the fix to other file extensions find and replace “VSDX” with whatever extension you are trying to make this work with. Once the fix is applied, you can right click the file and a new “Open With” menu can now expand where you can select Open with MS Edge in IE Mode.


#Visio Viewer Edge IE mode registry fix script

New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.vsdx\OpenWithProgids" -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.vsdx\OpenWithProgids" -Name "MSEdgeIEModeVSDX" -Value "0" -PropertyType DWORD -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX" -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\Application" -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\Application" -Name "ApplicationCompany" -Value "Microsoft Corporation" -PropertyType String -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\Application" -Name "ApplicationName" -Value "Microsoft Edge with IE Mode" -PropertyType String -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\Application" -Name "ApplicationIcon" -Value "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,4" -PropertyType String -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\Application" -Name "AppUserModelId" -Value "" -PropertyType String -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\DefaultIcon" -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\DefaultIcon" -Name "@" -Value "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,4" -PropertyType String -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\shell" -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\shell\open" -Force | Out-Null


New-Item -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\shell\open\command" -Force | Out-Null

New-ItemProperty -Path "HKCU:\SOFTWARE\Classes\MSEdgeIEModeVSDX\shell\open\command" -Name "@" -Value "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe,4" -PropertyType String -Force | Out-Null