Open CoolGaM3r215 opened 3 years ago
I'm getting this error too. Odd because I can't find 'SQLCMD' in the code?
I was rebuilding to a new Server 2019 with WSUS and moved this script over and ran into that error. You would need to do the following to get it to work.
Install the Microsoft® ODBC Driver 17 for SQL Server® - Windows, Linux, & macOS https://www.microsoft.com/en-us/download/details.aspx?id=56567
Then install the Microsoft Command Line Utilities 15 for SQL Server https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-2017
After I installed those two, the script worked like it normally does.
Install the Microsoft® ODBC Driver 17 for SQL Server® - Windows, Linux, & macOS https://www.microsoft.com/en-us/download/details.aspx?id=56567
Link is dead, here's the new one: https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server
Arrived at this issue again today for Win2022. I wonder if anyone is interested in converting it to Invoke-Sqlcmd
via https://www.powershellgallery.com/packages/SqlServer/ .
Exception Rebuilding DB Indexes: The term 'SQLCMD' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
How do I fix this?