Vesparum/Install-IRESSExcelAddins.ps1

[CmdletBinding()]
Param(
    [Switch]$Reinstall
)

# The path to the Registry key containing the IRESS installation details
$IressInstallRegPath = 'HKLM:\Software\Wow6432Node\DFS\IRESS\File'
# The name of the Registry property that gives the installation location
$IressInstallDirProp = 'InstallDir'

if (!(Test-Path -Path $IressInstallRegPath -PathType Container)) {
    throw 'Unable to locate IRESS installation.'
}

$IressInstallDirPath = (Get-ItemProperty -Path $IressInstallRegPath).$IressInstallDirProp
$IressExcelAddinsPath = Join-Path -Path $IressInstallDirPath -ChildPath 'ExcelAddins'
if (!(Test-Path -Path $IressExcelAddinsPath -PathType Container)) {
    throw 'IRESS Excel add-ins path is invalid.'
}

$IressExcelAddins = Get-ChildItem -Path $IressExcelAddinsPath
foreach ($Addin in $IressExcelAddins) {
    Write-Host -Object ('Installing Excel add-in: {0}' -f $Addin.Name)
    & (Join-Path -Path $PSScriptRoot -ChildPath 'Install-ExcelAddin') -AddinPath $Addin.FullName -NoCopy @PSBoundParameters
}