2012-02-20 93 views
18

它一直在发生,我用Windows服务器启动了一个虚拟机,但由于IE的安全性,我无法访问Internet。有没有人有一个简单的PowerShell脚本来禁用IE安全?通过PowerShell在Windows Server上禁用IE安全性

+0

要禁用哪些内容?退出?保护模式? – 2012-02-20 21:01:55

+1

是的,IE ESC(这里有几个字符可以让我发表这个评论????) – 2012-02-20 21:05:01

回答

35
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文件,这

然后在提示符下键入一个时期,一个空间和文件路径 是这样的:

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

然后就可以调用

[PS 1] Disable-InternetExplorerESC 
+0

你为什么要停止“资源管理器”,但不重新启动它? – wesm 2015-04-13 16:35:53

+0

@ wes2020我从某个地方偷了这个脚本,但我的假设是停止浏览器只'重新启动'它。如果它停止,资源管理器将启动 – 2015-04-20 21:40:31

+0

在Windows Server 2012中,这对我不起作用。如果您在应用此操作后启动IE,则仍会显示受信任的弹出窗口;在服务器管理器中,可信功能显示“关闭”,但如果点击配置,管理员和用户复选框仍显示“开”。 – MaxVT 2015-06-03 15:39:39

9

的下面修饰增加了-Force参数:在提示命令以避免任何确认。系统提示我在确认要结束“资源管理器”过程时执行此操作。

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 -Force 
    Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force 
    Stop-Process -Name Explorer -Force 
    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 -Force 
    Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 1 -Force 
    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 -Force 
    Write-Host "User Access Control (UAC) has been disabled." -ForegroundColor Green  
} 
Disable-UserAccessControl 
Disable-InternetExplorerESC 
相关问题