## Define base URL for getting installer $BaseURL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources' ## Build URL for Windows 10 If ( ([System.Environment]::OSVersion.Version).Major -ge 10 ) { If ( Test-Path "${Env:ProgramFiles(x86)}" ) { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win10RS_x64.msi' } Else { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win10RS_x86.msi' } } ## Build URL for Windows 7 ElseIf ( (([System.Environment]::OSVersion.Version).Major -ge 7) -and (([System.Environment]::OSVersion.Version).Major -lt 10) ) { If ( Test-Path "${Env:ProgramFiles(x86)}" ) { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win7-8.1_x64.msi' } Else { $URL = '{0}/{1}' -f $BaseURL, 'DisplayLink_Win7-8.1_x86.msi' } } ## Install package Write-Output "Installing: ${URL}" Start-Process -FilePath "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart" -Wait