stem.Text.RegularExpressions.RegexOptions]::IgnoreCase)
                    if($matches.Count -gt 0)
                    {
                        $publisher = $matches[0].groups["publisher"].Value
                    }
                }
                catch
                {
                }
            }
        }
    }
    return $publisher
}

#
# Get Addon Name
#
function GetAddonName([string]$module_guid = $(throw "No module guid is specified"))
{
    $addonName = ""
    $moduleKey = "Registry::HKEY_CLASSES_ROOT\CLSID\" + $module_guid
    if(-not (Test-Path $moduleKey))
    {
        $moduleKey = "Registry::HKEY_CLASSES_ROOT\WOW6432NODE\CLSID\" + $module_guid
    }

    if(Test-Path $moduleKey)
    {
        $prop = Get-ItemProperty -path $moduleKey
        if ($prop -ne $null)
        {
            $moduleName = $prop."(default)"
            if(-not [string]::IsNullOrEmpty($moduleName))
            {
                $addonName = $moduleName.Trim()
                $addonName = $addonName.Replace("&", "")
            }
        }
    }
    return $addonName
}

function GetAddonVersionInfo([string]$module_guid = $(throw "No module guid is specified"))
{
    $moduleKey = "Registry::HKEY_CLASSES_ROOT\CLSID\" + $module_guid + "\InprocServer32"
    if(Test-Path $moduleKey)
    {
        $prop = Get-ItemProperty -path $moduleKey
        if ($prop -ne $null)
        {
            $path = $prop."(default)"

            if(Test-Path $path)
            {
                return [System.Diagnostics.FileVersionInfo]::GetVersionInfo($path)
            }
        }
    }

    $moduleKey = "Registry::HKEY_CLASSES_ROOT\WOW6432NODE\CLSID\" + $module_guid + "\InprocServer32"
    if(Test-Path $moduleKey)
    {
        $prop = Get-ItemProperty -path $moduleKey
        if ($prop -ne $null)
        {
            $path = $prop."(default)"

            if(Test-Path $path)
            {
                return [System.Diagnostics.FileVersionInfo]::GetVersionInfo($pat# Copyright  2008, Microsoft Corporation. All rights reserved.

#
#Localization Data
#
Import-LocalizedData -BindingVariable localizationString -FileName IEBrowseWeb_TroubleShooter

. .\TS_IEAddon.ps1

Write-DiagProgress -activity $localizationString.Check_DefectiveAddon

[bool]$result = $false
#
#Get the IE Add-on module informations from registry
#
[System.Collections.Hashtable]$ModulesHash = GetAddonModules

if($ModulesHash -ne $null -and $ModulesHash.count -gt 0)
{
    #
    # get IE enabled Addon
    #
    [System.Collections.Hashtable]$enabledAddonParaHash = GetIEEnabledAddon $ModulesHash
    if($enabledAddonParaHash -ne $null -and $enabledAddonParaHash.Count -gt 0)
    {
        [System.Collections.Hashtable]$loadingTimeHash = GetIEAddonLoadingTime $enabledAddonParaHash
        [double]$loadingTime = 0
        foreach($key in $loadingTimeHash.Keys)
        {
            $loadingTime +=  $loadingTimeHash.item($key)
        }
        if($loadingTime -gt 1000)
        {
            $result = $true
            $enabledAddonParaHash | Export-Clixml -path EnabledAddonHash.xml
            $loadingTimeHash | Export-Clixml -path EnabledAddonLoadingTimeHash.xml
        }
        WriteIEAddonReport $loadingTimeHash "loadTimeIEAddon"
    }
}

if($result)
{
    Update-DiagrootCause -id RC_IEaddonLoadingTime -Detected $true
}
else
{
    Update-DiagrootCause -id RC_IEaddonLoadingTime -Detected $false
}