Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE Browser - Powershell script to add site to trusted sites list, disable protected mode & make all zones security level low

For our website to run we need to:

  1. add site to trusted sites list [Solved]
  2. disable IE protected mode [Solved]
  3. bring down security level for all zones. [facing Issue]

I am automating this site. As a prerequisite i have to take care of security features.

I have create below code. But i am not able to set security level to zero. I can't find 1A10 in zones.

My Registry

I am adding solved issues code as well. Hoping it might help someone in need

Helpful sites -

https://x86x64.wordpress.com/2014/05/20/powershell-ie-zones-protected-mode-state/ https://support.microsoft.com/en-in/help/182569/internet-explorer-security-zones-registry-entries-for-advanced-users https://blogs.technet.microsoft.com/heyscriptingguy/2015/04/02/update-or-add-registry-key-value-with-powershell/

#1. Add site to trusted sites

#Setting IExplorer settings
Write-Verbose "Now configuring IE"

#Navigate to the domains folder in the registry
set-location "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
set-location ZoneMap\Domains

#Create a new folder with the website name
new-item testsite.site.com/ -Force #website part without https
set-location testsite.site.com/
new-itemproperty . -Name https -Value 2 -Type DWORD -Force

Write-Host "Site added Successfully"
Start-Sleep -s 2

# 2. Disable IE protected mode

# Disabling protected mode and making level 0

#Zone 0 – My Computer
#Zone 1 – Local Intranet Zone
#Zone 2 – Trusted sites Zone
#Zone 3 – Internet Zone
#Zone 4 – Restricted Sites Zone

#“2500” is the value name representing “Protected Mode” tick. 3 means Disabled, 0 – Enabled

#Disable protected mode for all zones
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1" -Name 2500 -Value "3"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" -Name 2500 -Value "3"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" -Name 2500 -Value "3"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4" -Name 2500 -Value "3"

Write-Host "IE protection mode turned Off successfully"
Start-Sleep -s 2

# 3. Bring down security level for all zones

#Set Level 0 for low 
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1" -Name 1A10 -Value "0"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" -Name 1A10 -Value "0"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" -Name 1A10 -Value "0"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4" -Name 1A10 -Value "0"

Stop-Process -name explorer

Thanks in Advance Guys!!

like image 903
KR Akhil Avatar asked Aug 07 '18 06:08

KR Akhil


People also ask

How do I add a site to my trusted sites in IE?

To do this, follow these steps: In Internet Explorer, click Tools, click Internet Options, and then click the Security tab. In the Select a Web content zone to specify its current security settings box, click Trusted Sites, and then click Sites.

Why can't I add trusted sites in Internet Explorer?

You cannot add a Web site to the "Trusted sites" zone even when the current user account belongs to the Administrators group. This problem occurs if the "Security Zones: Use only machine settings" Group Policy setting is enabled.


1 Answers

just remove "0" and replace with 0 it worked for me.

Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" -Name 1A10 -Value 0
like image 162
user12898235 Avatar answered Oct 13 '22 02:10

user12898235