02 May 2014

Enable or Disable Internet Explorer Active X Components

This script will enable or disable Internet Explorer Active X components. All you have to do is pass the user friendly name of the component, component's GUID, and the flag. The app will verify if the change actually takes place and returns a success or failure status.

You can download this from here.


<#
.SYNOPSIS
   Enable/Disable IE Active X Components
.DESCRIPTION
   
.PARAMETER <paramName>
   <Description of script parameter>
.EXAMPLE
   EnableIEActiveXControl "Application Name" "GUID" "Value"
   EnableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000000"
#>

#Declare Global Memory
Set-Variable -Name Errors -Value $null -Scope Global -Force
Set-Variable -Name LogFile -Value "c:\windows\waller\Logs\BuildLogs\AdobeFlashPlayer.log" -Scope Global -Force
Set-Variable -Name RelativePath -Scope Global -Force

Function ConsoleTitle ($Title){
    $host.ui.RawUI.WindowTitle = $Title
}

Function GetRelativePath { 
    $Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\" 
}

Function DisableIEActiveXControl ($AppName,$GUID,$Flag) {
    $Key = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\"+$GUID
    If ((Test-Path $Key) -eq $true) {
        Write-Host $AppName"....." -NoNewline
        Set-ItemProperty -Path $Key -Name "Compatibility Flags" -Value $Flag -Force
        $Var = Get-ItemProperty -Path $Key -Name "Compatibility Flags"
        If ($Var."Compatibility Flags" -eq 1024) {
            Write-Host "Disabled" -ForegroundColor Yellow
        } else {
            Write-Host "Enabled" -ForegroundColor Red
        }
    }
}

Function EnableIEActiveXControl ($AppName,$GUID,$Flag) {
    $Key = "HKLM:\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\"+$GUID
    If ((Test-Path $Key) -eq $true) {
        Write-Host $AppName"....." -NoNewline
        Set-ItemProperty -Path $Key -Name "Compatibility Flags" -Value $Flag -Force
        $Var = Get-ItemProperty -Path $Key -Name "Compatibility Flags"
        If ($Var."Compatibility Flags" -eq 0) {
            Write-Host "Enabled" -ForegroundColor Yellow
        } else {
            Write-Host "Disabled" -ForegroundColor Red
        }
    }
}

cls
#DisableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000400"
EnableIEActiveXControl "Flash for IE" "{D27CDB6E-AE6D-11CF-96B8-444553540000}" "0x00000000"
Start-Sleep -Seconds 5

Related Posts:

  • Replicate Permissioning Here is a script I have written that will replicate the permissions between two folders including all subfolders and file permissions. Execute the script and you will be prompted for the source and destination folders. It w… Read More
  • Deployment Module This module is designed to make automating the installation of software a breeze. It also provides logging that makes it easy to check and see if there were errors during an installation. The logging has been designed so tha… Read More
  • Uninstall All Printers Recently, we upgraded our print servers and needed to reinstall all of the printers. This script will uninstall all printers. I deployed this script out and had it run as the user and a GPO reinstalled the printer with the … Read More
  • Enable Bitlocker on a Dell System After much research and troubleshooting, here is how to enable bitlocker on a Dell system, including clearing the TPM. The documentation by Dell, Trusted Computing Group, and advice from this thread and this one sa… Read More
  • Windows Reboot Verification Script The firm I work for does a weekly reboot. As we revamped our SCCM and AD, it was time to revisit the reboot process. I decided to use PowerShell in conjunction with SCCM to handle this process. To make the process easier to … Read More

1 comments: