Install SQL Native Client Silent

Hello…

The sqlncli.msi file is in the user roaming folder.

I’m trying to install with the following code:

I don’t get an error message, but the client is not installed.
Does anyone know what I’m doing wrong?
Thank you very much for your help …

Clear

$TmpPath = "$env:APPDATA\TmpCopyFiles\"
$NativeFile = 'sqlncli.msi'

$Arguments = @("/i", ('"{0}"' -f ($TmpPath.Replace('*','') + $NativeFile)),"/qn IACCEPTSQLNCLILICENSETERMS=YES")
$Arguments

Start-Process msiexec.exe -ArgumentList $Arguments -Wait

[quote quote=262931]Hello…

The sqlncli.msi file is in the user roaming folder.

I’m trying to install with the following code:

I don’t get an error message, but the client is not installed.

Does anyone know what I’m doing wrong?

Thank you very much for your help …

PowerShell
Press CTRL+C to Copy, CTRL+V to Paste

<textarea class=“urvanov-syntax-highlighter-plain print-no” style=“tab-size: 4; font-size: 14px !important; line-height: 18px !important; z-index: 1; opacity: 1; height: 180px;” readonly=“readonly” data-settings=“dblclick”>Clear

$TmpPath = “$env:APPDATA\TmpCopyFiles”
$NativeFile = ‘sqlncli.msi’

$Arguments = @("/i", (’"{0}"’ -f ($TmpPath.Replace(’*’,’’) + $NativeFile)),"/qn IACCEPTSQLNCLILICENSETERMS=YES")
$Arguments

Start-Process msiexec.exe -ArgumentList $Arguments -Wait</textarea>

1
2
3
4
5
6
7
8
9
Clear
$TmpPath = "$env:APPDATA\TmpCopyFiles\"
$NativeFile = 'sqlncli.msi'
$Arguments = @("/i", ('"{0}"' -f ($TmpPath.Replace('*','') + $NativeFile)),"/qn IACCEPTSQLNCLILICENSETERMS=YES")
$Arguments
Start-Process msiexec.exe -ArgumentList $Arguments -Wait
[/quote]

See if you are able to pass the arguments and use call operator

$cmd = "msiexec.exe" + " " + $Arguments
& $cmd | out-null

[quote quote=262931]Hello…

The sqlncli.msi file is in the user roaming folder.

I’m trying to install with the following code:

I don’t get an error message, but the client is not installed.

Does anyone know what I’m doing wrong?

Thank you very much for your help …

PowerShell

<textarea class=“urvanov-syntax-highlighter-plain print-no” style=“tab-size: 4; font-size: 14px !important; line-height: 18px !important; z-index: 0; opacity: 0;” readonly=“readonly” data-settings=“dblclick”>Clear

$TmpPath = “$env:APPDATA\TmpCopyFiles”
$NativeFile = ‘sqlncli.msi’

$Arguments = @("/i", (’"{0}"’ -f ($TmpPath.Replace(’*’,’’) + $NativeFile)),"/qn IACCEPTSQLNCLILICENSETERMS=YES")
$Arguments

Start-Process msiexec.exe -ArgumentList $Arguments -Wait</textarea>

1
2
3
4
5
6
7
8
9
Clear
$TmpPath = "$env:APPDATA\TmpCopyFiles\"
$NativeFile = 'sqlncli.msi'
$Arguments = @("/i", ('"{0}"' -f ($TmpPath.Replace('*','') + $NativeFile)),"/qn IACCEPTSQLNCLILICENSETERMS=YES")
$Arguments
Start-Process msiexec.exe -ArgumentList $Arguments -Wait
[/quote]

see if you are able to use call operator

$cmd = msiexec.exe + " "+ $Arguments
& $cmd | out-null

Also does not work

I personally like to build command line arguments in an array. I’ve added a log for you to get more info in case it fails for you. I’ve tested this on several different systems with different operating systems.

$msiargs = @(
    "/i"
    "$env:APPDATA\TmpCopyFiles\sqlncli.msi"
    "/qn"
    "IACCEPTSQLNCLILICENSETERMS=YES"
    "/L*V $env:temp\sqlNativeClientInstall.log"
)

Start-Process msiexec -ArgumentList $msiargs -Wait

If it’s still not installing I would try the opposite architecture package (if 32 bit is failing try 64 bit or vice versa)

I’m using your code, I found error 1603 in the log file.
I have now run the code as admin and it worked.

Thank you for your help

Start-Process msiexec.exe -Verb RunAs -Wait -PassThru -ArgumentList "$Arguments"