## Define base URL for getting installer
$BaseURL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources'

## Build URL for Windows 10
If ( IsWindowsVersion -ge "10.0" )
{
    If ( Is64bit ) { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win10RS_x64.msi' }
    Else           { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win10RS_x86.msi' }
}

## Build URL for Windows 7, 8, and 8.1
ElseIf ( (IsWindowsVersion -ge "6.1") -and (IsWindowsVersion -lt "10.0") )
{
    If ( Is64bit ) { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win7-8.1_x64.msi' }
    Else           { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win7-8.1_x86.msi' }
}
Else { LogMsg "Operating system is not supported" ; Exit }

## Install DisplayLink
Install-Program -Path "msiexec.exe" -Arguments "/i ${URL} /qn /norestart"
