Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke-ASCmd not a cmdlet in Powershell Module sqlserver (version 21.1.18228)

I'm trying to do some automation with SQL Server Analysis Services using Powershell.

Research points me to "Invoke-ASCmd" command as the one to use as per this documentation: https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-ascmd?view=sqlserver-ps#examples

However, even after installing the SqlServer Module, I don't see "Invoke-ASCmd" in the list of commands. I'm assuming this comes default with this module. If I run this command with no parameters, I get the following response:

"Invoke-ASCmd: The term 'Invoke-ASCmd' 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."

If I do a Get-Command -module sqlserver I don't see "Invoke-ASCmd" in the list.

like image 480
thomassantosh Avatar asked Feb 11 '26 04:02

thomassantosh


1 Answers

First of all you want to make sure that the SQL Server Module is installed and available. You can do this by using Get-Module cmdlet.

Get-Module SqlServer -ListAvailable

Once you are sure SQL Server Module is installed you want to import by using Import-Module cmdlet as well as specifying version.

Import-Module SqlServer -Version 21.1.18080

After that you can use Get-Command cmdlet to see if particular module is loaded and has needed commands you trying to use. Like so:

Get-Command -Module SqlServer

like image 71
Kirill Pashkov Avatar answered Feb 13 '26 13:02

Kirill Pashkov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!