How to fix “The term ‘Invoke-ProcessASDatabase’ is not recognized”

Last week I needed to process an Azure Analysis Services model via Powershell and tried using the Invoke-ProcessASDatabase, as described here. On my server I have SQL installed, together will all the management tools I might ever need, so I did not expect to have any issues. So I just ran the command and it seemed it was missing. That’s strange! 

So, here are the steps I used to troubleshoot and fix the issue:

  1. Run the Get-Module command and look for SqlServer. If it is not imported, make sure you do that (instructions: here)
  2. Run Get-Command -Module SqlServer to list all commands in the cmdlet. If Invoke-ProcessASDatabase is there, then you have a permission/syntax issue. If it is not there, go to step 3
  3. Reinstall the SqlServer powershell module but this time overriding any existing packages, using -AllowClober. This will overwrite any existing packages with the most current ones (as long as you have internet connection; if not, follow the offline installation instructions from step 1’s link). The command itself should look like this:
    Install-Module -Name sqlserver -AllowClobber

This fixed it for me. I did a quick research on why that would happen and it was related to some .NET and PoSH version mashup, manifest file issues, etc. (or something totally unrelated to that, but not so important to troubleshoot anymore anyway)