Disable IE security on Windows Server via PowerShell

后端 未结 2 1908
独厮守ぢ
独厮守ぢ 2020-12-28 14:02

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 f

相关标签:
2条回答
  • 2020-12-28 14:16

    The below modification has added -Force parameters to avoid any confirmations. I was prompted to do this when prompted to confirm that I wanted to end the "explorer" process..

    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
    
    0 讨论(0)
  • 2020-12-28 14:27
    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    
    }
    

    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
    
    0 讨论(0)
提交回复
热议问题