System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Tevon 35 Reputation points
2023-05-02T19:51:48.8033333+00:00

Could someone help clarify the way to utilize these steps in order to fix my sharepoint configuration. It currently stops at stage five with the error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. It's not clear which parts I insert with my own information and what is just copied and pasted.

Step 1: Enable search admin timer job via PowerShell.

Copy

 Enable-SPTimerJob job-application-server-admin-service  

Step 2: Update the account running Osearch15/Hostcontroller services using:

Copy

$password = Read-Host -AsSecureString  
Set-SPEnterpriseSearchService -IgnoreSSLWarnings $true -ServiceAccount <domain\Account> -ServicePassword $password  

Step 3: Make sure the account you use to configure the application is a member of the WSS_WPG group and the group has full control over the following path.

Copy

C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server\Applications.  

Step 4: Run following powershell to check if AdminComponents has value returned.

Copy

$ssa = Get-SPEnterpriseSearchServiceApplication 'Search Service Application'  
Get-SPEnterpriseSearchAdministrationComponent -SearchApplication $ssa  

If not, set as following:

Copy

$varInstance = Get-SPEnterpriseSearchServiceInstance -local  
set-spenterprisesearchadministrationcomponent –searchapplication $varSearchApp –searchserviceinstance 
Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,241 Reputation points Microsoft External Staff
    2023-05-03T08:26:44.2933333+00:00

    Hi @Tevon ,

    Thank you for your description. Regarding your question, there may be some things I don't understand and I want to confirm with you.

    1. Did you get the error message "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation." when you executed the following statement?
    $varInstance = Get-SPEnterpriseSearchServiceInstance -local set-spenterprisesearchadministrationcomponent –searchapplication $varSearchApp –searchserviceinstance
    
    1. Did you refer to a link for this step? Could you please send it to me for reference test?
    2. What function do you want to achieve in the end, can you describe it in detail?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.