Sma_Inka

disable IEESC .ps1

Jan 13th, 2021
728
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. foreach($Computer in $ComputerName) {
  2. if(!(Test-Connection -Computer $Computer -count 1 -ea 0)) {
  3. Write-Host "$Computer NOT REACHABLE"
  4. $FailedComps += $Computer
  5. continue
  6. }
  7. Write-Host "Working on $Computer"
  8. try {
  9. $BaseKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$Computer)
  10. $SubKey = $BaseKey.OpenSubKey($AdministratorsKey,$true)
  11. $SubKey.SetValue("IsInstalled",0,[Microsoft.Win32.RegistryValueKind]::DWORD)
  12. $SubKey = $BaseKey.OpenSubKey($UsersKey,$true)
  13. $SubKey.SetValue("IsInstalled",0,[Microsoft.Win32.RegistryValueKind]::DWORD)
  14. Write-Host "Successfully disabled IE ESC on $Computer"
  15. $SuccessComps += $Computer
  16. }
  17. catch {
  18. Write-Host "Failed to disable IE ESC on $Computer"
  19. $FailedComps += $Computer
  20. }
  21. }
RAW Paste Data