function allowActiveX($zone='Trusted'){
#Source: https://learn.microsoft.com/en-us/previous-versions/troubleshoot/browsers/security-privacy/ie-security-zones-registry-entries
#Reference table:
#Value Setting
#------------------------------
#0 My Computer
#1 Local Intranet Zone
#2 Trusted sites Zone
#3 Internet Zone
#4 Restricted Sites Zone
$hashMap=@{
'2702'=0 #ActiveX controls and plug-ins: Allow ActiveX Filtering = Enable (2702)
'1208'=0 #ActiveX controls and plug-ins: Allow previously unused ActiveX controls to run without prompt = Enable (1208)
'1209'=0 #ActiveX controls and plug-ins: Allow Scriptlets = Enable (1209)
'2201'=3 #ActiveX controls and plug-ins: Automatic prompting for ActiveX controls = Disable (2201)
'2000'=0 #ActiveX controls and plug-ins: Binary and script behaviors = Enable (2000)
'120A'=0 #Display video and animation on a webpage that does not use external media player = Enable (120A)
'1001'=0 #ActiveX controls and plug-ins: Download signed ActiveX controls = Enable (1001)
'1004'=0 #ActiveX controls and plug-ins: Download unsigned ActiveX controls = Enable (1004)
'1201'=0 #ActiveX controls and plug-ins: Initialize and script ActiveX controls not marked as safe for scripting = Enable (1201)
'120B'=3 #Only allow approved domains to use ActiveX without prompt = Disable (120B)
'1200'=0 #ActiveX controls and plug-ins: Run ActiveX controls and plug-ins = Enable (1200)
'1405'=0 #ActiveX controls and plug-ins: Script ActiveX controls marked as safe for scripting = Enable (1405)
}
$zoneCode=switch($zone){
'My Computer'{0;break}
'Local Intranet'{1;break}
'Trusted'{2;break}
'Internet'{3;break}
'Restricted Sites'{4;break}
default{2}
}
$trustedDomains="HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\zones\$zoneCode"
$currentValues=Get-ItemProperty $trustedDomains
foreach ($item in $hashMap.GetEnumerator()) {
$key = $item.Key
$value = $item.Value
if($currentValues.$key -ne $value){
$null=New-ItemProperty -Path $trustedDomains -Name $key -Value $value -PropertyType DWORD -Force
}
}
}
Categories: