Powershell exception when trying to start Usage Analytics
-
29-09-2020 - |
Question
I am following the instructions detailed in this blog post Usage analytics in SharePoint Server 2013, however when I attempt to start the Usage Analytics via Powershell I get an exception:
$a = Get-SPTimerJob -Type Microsoft.Office.Server.Search.Analytics.AnalyticsJobDefinition
$sa = $a.GetAnalysis("Microsoft.Office.Server.Search.Analytics.SearchAnalyticsJob")
$sa.StartAnalysis()
Exception calling "StartAnalysis" with "0" argument(s): "No system manager locations set, search application might not be ready yet."
How can I trigger the usage analytics process?
Solution 3
This turned out to be a permissions issue.
The user I was logged on and running SharePoint Management Shell did not have access to the 'Search_Service_Application_' databases. When I allowed access for the user, the StartAnalysis() cmdlet executes successfully.
OTHER TIPS
Have you tried to provision the Usage Application?
$usage = Get-SPServiceApplicationProxy | where {$_.TypeName -like "Usage*"}
$usage.Provision()
That is the most probable solution.
This post indicates it can also be a time mismatch problem:
After looking at it for a while, it is because of a time skew between the VM server and the host machine. Do’h! So make sure that the time is synced between the two environments!
It can also be a side-effect of limiting how much memory noderunner.exe
process is allowed to use, read more here.
Do have a look at what robert has mentioned. Also, have you used the $sa object somewhere above those three lines of code in the same powershell window ? I have faced this similar issue of "calling an X function with 0 parameters" many times (but not with the same scenario of starting the usage analysis) and it turned out that you need to close the current powershell window, open a new one, run the commands and your code works !!
If you are running the powershell comman-by-command, try a fresh powershell window and all the commands in one go.