SharePoint Management Shell – Exception has been thrown by the target of an invocation


While running PowerShell scripts on a SharePoint Server you might encounter this error “Exception has been thrown by the target of an invocation”

Exception has been thrown by the target of an invocation

The error is really not self-explanatory, however the only problem is that you don’t have enough permissions on the Site or Web in question. Even if you are a farm admin and local admin on the server, some SharePoint PowerShell Commands will not allow you to run at the SITE or Web level.

Easiest way to fix it, since you already have access to the server, give yourself Full Control at the Web Application Level (in User Policy) and you shouldn’t have this problem anymore!

Leave  a comment and don’t forget to like us on Facebook here and to follow me on Google+ here and on Twitter here  for the latest news and technical articles on SharePoint.  Also, don’t forget to check out SharePoint Community.Net for more great SharePoint Content

Previous Post
A review of the SharePoint Outlook integration tool by
Next Post
An unexpected error has occurred when a user clicks on My Settings to access MySites


  • March 12, 2014 at 4:53 am
    anil alladi

    I already have full control on a particular web application, and I am one of the farm administrators too.
    But still I am getting the above error while executing one powershell script.

    • March 14, 2014 at 12:27 am

      Did you run powershell as an administrator?

      • March 14, 2014 at 1:44 am
        anil alladi


    • October 12, 2016 at 11:55 am

      Add your user account to the local group (in Computer Management), WSS_RESTRICTED_WPG_V4. This group should give you the necessary rights to run SharePoint Management Shell.

      Alternatively, if you have the password for the Farm Administrator (the user running owstimer.exe), simply run PowerShell “As Administrator”, then use runas.exe /noprofile /env /user:domain\farmadmin “powershell.exe”. This will launch a new instance of PowerShell running as the Farm Administrator. Then simply import the SharePoint snapin using:

      Add-PSSnapin Microsoft.SharePoint.PowerShell

      You can then use Add-SPShellAdmin domain\yourusername to add yourself to the Shell Admins, thus granting yourself access.

      This came from

      it worked for me.

  • September 9, 2014 at 9:42 am

    installed powershell 3.0 and it should resolve it

  • February 26, 2015 at 3:12 pm
    Bart Kuppens

    I had the same thing…. farm admin, full control policy. I was even site collection admin. No access. Then I ran add-spshelladmin on the content database and that did the trick.

  • October 7, 2015 at 12:02 am

    I have added the user in Full Control at the Web Application Level (in User Policy) and working fine.
    web application->User Policy->Add User as Full Control


Leave a Reply

15 49.0138 8.38624 1 0 4000 1 300 1