SQLPS on my workstation used to take around 30 seconds to import. Not exactly speed-of-thought, but acceptable.
Now it takes around 30 minutes! This is unacceptable because it blocks my spontaneous PowerShell queries.
What could have changed to make the module so unbearably slow to load?
The ISE debugger has helped me to narrow down the cause, but not enough to say what the problem is or how to fix it.
In a new instance of ISE I open a one-line script to import the module.
I set a breakpoint on the line and start debugging.
I press 's' repeatedly at the prompt to step into every subsequent breakpoint until the module has loaded.
The debugger seems to skip some lines. I'm not sure I'm getting the whole picture, but I carry on.
Between this line in Sqlps.ps1:
Set-Variable -scope Global -name SqlServerMaximumTabCompletion -Value 1000
and this line in SqlPsPostScript.ps1:
I have to wait a very long time.
Just before the debugger returns control, it produces this output.
WARNING: The local computer does not have an active instance of Analysis Services.
The warning about Analysis Services could be misleading. Analysis Services has never been installed on my workstation. The warning appeared when performance was still fast enough.
How can I track down the true source of the problem and fix it?