SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a remote powershell script which attempts to setup a web-application and site collection and then attempts to add a user to that site collection.

I receive the following error:

New-SPUser : Access is denied. (Exception from HRESULT: 0x80070005)

This does not occur if I run the same script locally with the same administrative account.

share|improve this question
up vote 2 down vote accepted

The answer is to run GrantAccessToProcessIdentity on your web-application

$webApp = Get-SPWebApplication -Identity <Identity>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.