问题描述
要运行我们的网站,我们需要:
For our website to run we need to:
- 将站点添加到受信任的站点列表[已解决]
- 禁用IE保护模式[已解决]
- 降低所有区域的安全级别. [面对问题]
我正在使这个网站自动化.作为前提条件,我必须注意安全功能.
I am automating this site. As a prerequisite i have to take care of security features.
我创建了以下代码.但是我无法将安全级别设置为零.我在区域中找不到1A10.
I have create below code. But i am not able to set security level to zero. I can't find 1A10 in zones.
我还要添加已解决问题的代码.希望它可以帮助有需要的人
有用的站点-
https://x86x64. wordpress.com/2014/05/20/powershell-ie-zones-protected-mode-state/ https: //support.microsoft.com/zh-CN/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
感谢高级人员!
推荐答案
只需删除"0"并替换为0即可.
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
这篇关于IE浏览器-Powershell脚本,用于将站点添加到受信任的站点列表,禁用保护模式&降低所有区域的安全级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!