參考http://www.vladsitblog.com/install-sql-native-client-with-powershell/
Client 11.msi install file, from this web page:SQL Native Client 11 download page
將下載後的檔案放在c:\SRC\batch資料夾
#install sqlncli 11.0
$client11 = $false
$checkClient = Get-ChildItem ‘HKLM:\Software\Microsoft\*’ -ea SilentlyContinue | Where {$_.name -like ‘*Client*’}
if ($checkClient.name.Split(‘\’) -eq ‘Microsoft SQL Server Native Client 11.0’) {
Write-Host ‘SQL Native Client 11.0 has been already installed’ $client11 = $True
} else {
Write-Host ‘Version 11 not present’
$client11 = $false
}
if ($client11 -eq $false){
try {
Write-Host ‘Installing Native Client 11’
cd C:\SRC\batch
$client11Install = msiexec.exe /qn /i sqlncli.msi IACCEPTSQLNCLILICENSETERMS=YES /L*V C:\SRC\batch\sqlNativeClientInstall.log
} Catch {
Write-Host ‘SQL Native Client 11 was not installed. Manual action required’
}
}
Start-Sleep 15