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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With