Credential problems with Sharepoint when running commands/scripts in command prompt or PowerShell

If you encounter problems when you are trying to execute a command or script which you know should work but does not consider checking that you are sufficient privileges to your environment where you are operating.

The most common problem I encounter regarding privileges is the error message when lets say you want to add a solution package.

The error message is something like this: “object reference not set to an instance of an object”. The message is misguiding you IF the problem is related to privileges.

Or another error message might go something like this: “Unable to access the local farm” or “The local farm is not accessible” etc.

If the case of insufficient privileges what is really going on is that you are missing some privileges to your environment or you do not have admin rights when executing scripts/commands.

Things to check:

  1. Check that the user account that you are using has sufficient privileges to do the operation that you want it to. Having rights to a site or site collection does not help you if you want to add a solution or delete one.
  2. Check that the user account has enough privileges in the SQL Server database. Depending on your operation that you are trying to perform either Content Database(s) or the Configuration Database.
  3. Check that you are running the Command Prompt or PowerShell as an Administrator. This applies to the following situation:

“If your user account is a member of the Administrators group, but is not the Administrator account itself, then, by default, the programs that you run only have standard user permissions. You must explicitly specify that you require the use of your administrative permissions by using one of the procedures in this topic.” Source: http://technet.microsoft.com/en-us/library/cc947813(v=ws.10).aspx

runas

Hope this helps someone :).

 

PS. And always check you logs :). Both SP and Event logs of your server.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s