通过PowerShell禁用Windows Server上的IE安全性 [英] Disable IE security on Windows Server via PowerShell

查看:233
本文介绍了通过PowerShell禁用Windows Server上的IE安全性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它一直在发生,我用Windows服务器启动vm,因为IE安全性而无法访问互联网。有没有人有一个简单的PowerShell脚本来禁用IE安全性?

it happens all the time, I spin up a vm with windows server and I can't access the internet because of IE security. Does anyone have a straight-forward PowerShell script for disabling IE security?

推荐答案

function Disable-InternetExplorerESC {
    $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
    $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
    Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
    Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
    Stop-Process -Name Explorer
    Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
}
function Enable-InternetExplorerESC {
    $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
    $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
    Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 1
    Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 1
    Stop-Process -Name Explorer
    Write-Host "IE Enhanced Security Configuration (ESC) has been enabled." -ForegroundColor Green
}
function Disable-UserAccessControl {
    Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000
    Write-Host "User Access Control (UAC) has been disabled." -ForegroundColor Green    
}

将其删除为.ps1文件

drop this into a .ps1 file

然后在提示符下键入一个句点,一个空格和文件
的路径,如下所示:

then at the prompt type a period, a space and the path to the file something like this:

[PS 1] . C:\Users\Administrator\Desktop\YourPowerShellScript.ps1

然后你可以打电话给提示符处的命令:

Then you can call the command at the prompt:

[PS 1] Disable-InternetExplorerESC

这篇关于通过PowerShell禁用Windows Server上的IE安全性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆