-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlCmd 1.5.0 Access Denied in Elevation mode against WID - Work fine with old SqlCmd 15 (SQL2019) #506
Comments
If you run the command with "--driver-logging-level 255" do we get more info on what is failing? (I don't have WID set up on my local machine) |
The issue could be how sqlcmd or go-mssqldb converts ODBC passes the named pipe path verbatim to I don't know why WID's instance would block it but SQL instances do not:
|
This bug is still present in version 1.6.0, is there any ETA when this get's fixed? |
Seems to be sorted for me on the v1.8.0 version.... sqlcmd-windows-amd64.zip. |
I use SQLCMD since many years to launch scripts on Microsoft WSUS databases (WID) like backup, shrink, etc.
Sinc some years I used the SQLCMD from "SQL Command Line Utilities 15" (MsSqlCmdLnUtils64.msi) and I never had issue. Everything is working fine.
I decided to move with SqlCmd 1.5.0 (latest vesion) to be up-to-date, security fixes. But he didn't work.
Due to a WID database limitation where it's not work in network and need administrator elevation, with old SqlCmd.exe I work like that:
1- Open a Command Line in elevation mode
2- Go to the SqlCmd Binn folder (C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\SQLCMD.exe). Version 15.0.2000.5
3- Type the command line to run my action. In this sample I will run a T-SQL script to shrink the database:
sqlcmd -S np:\.\pipe\MICROSOFT##WID\tsql\query -i "C:\script\shrink.sql" -o "C:\Script\shrink.log"
The content of the shrink.sql is:
USE [SUSDB]
GO
DBCC SHRINKDATABASE(N'SUSDB')
GO
DBCC SHRINKFILE(N'SUSDB', 0, TRUNCATEONLY)
GO
4- Everything work fine ! The database and files are shrinked !!!
If I install SqlCmd 1.5.0, I run the same command line, The I got in the log file:
Access denied
Access denied
It seem SqlCmd 1.5.0 have difficulties to connect.
The text was updated successfully, but these errors were encountered: