Skip to content

Instantly share code, notes, and snippets.

@pcrockett-pathway
Created March 5, 2019 12:35
Show Gist options
  • Select an option

  • Save pcrockett-pathway/b1a9afb447118e0e22945cbb45ef28f9 to your computer and use it in GitHub Desktop.

Select an option

Save pcrockett-pathway/b1a9afb447118e0e22945cbb45ef28f9 to your computer and use it in GitHub Desktop.
Example of editing the registry in PowerShell
#Requires -RunAsAdministrator
[CmdletBinding()]
param()
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 5.0
# Not fully tested. Before you try this, try clearing IE's history and
# temporary files. EVERYTHING. That will probably do it for you.
# From https://support.microsoft.com/en-us/help/3071338/internet-explorer-11-adds-support-for-http-strict-transport-security-s
$key = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_HSTS"
$property = "iexplore.exe"
$propType = "DWORD"
$value = 1
if (!(Test-Path $key)) {
New-Item $key | Out-Null
}
Set-ItemProperty $key -Name $property -Value $value -Type $propType
if ([System.Environment]::Is64BitOperatingSystem) {
# Need to do this for an additional x64-specific registry key
$x64Key = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DISABLE_HSTS"
if (!(Test-Path $x64Key)) {
New-Item $x64Key | Out-Null
}
Set-ItemProperty $x64Key -Name $property -Value $value -Type $propType
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment