powershell - IE 浏览器 - Powershell 脚本,用于将站点添加到受信任站点列表、禁用保护模式并降低所有区域的安全级别

标签 powershell internet-explorer registry

为了让我们的网站运行,我们需要:

  • 将站点添加到受信任站点列表 [已解决]
  • 禁用 IE 保护模式 [已解决]
  • 降低所有区域的安全级别。 [面临问题]

  • 我正在自动化这个网站。作为先决条件,我必须注意安全功能。

    我创建了以下代码。但我无法将安全级别设置为零。我在区域中找不到 1A10。

    My Registry

    我也在添加已解决的问题代码。希望能帮到有需要的人

    有用的网站 ——

    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
    

    在此先感谢你们!!

    最佳答案

    只需删除“0”并用 0 替换它对我有用。

    Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2" -Name 1A10 -Value 0
    

    关于powershell - IE 浏览器 - Powershell 脚本,用于将站点添加到受信任站点列表、禁用保护模式并降低所有区域的安全级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51720030/

    相关文章:

    javascript - 对于 IE 的 "executed script statement"警告计数器,什么算作 "Stop running this script?"?

    css - IE后台问题

    c# - 将文件扩展名与应用程序相关联

    powershell - 使用 PowerShell 远程运行注册表文件

    powershell - 以编程方式创建参数 block 时无法生成 ParameterSetMetadata

    xml - 在 powershell 中解析 xml

    .net - 与Server 2008 R2上的Internet Explorer ComObject交互时出现问题

    powershell - 如何禁用/覆盖 PowerShell 点符号

    windows - 如何增加 Windows 10 的最大 GDI 对象数量?

    css - Internet Explorer 吞噬事件