PowerShell ISE, add-spsolution, access denied

Hi,

We are trying to add a solution to the farm solution store but end up with this error message:

PS C:\> add-spsolution -LiteralPath E:\Apps\EasyIntegrator\Data\SiteTemplates\b6AABCKlasseTeamsite2010.wsp
Add-SPSolution : Access denied.
At line:1 char:15
+ add-spsolution <<<<  -LiteralPath E:\Apps\EasyIntegrator\Data\SiteTemplates\b6AABCKlasseTeamsite2010.wsp
    + CategoryInfo          : InvalidData: (Microsoft.Share...dletAddSolution:SPCmdletAddSolution) [Add-SPSolution], SecurityException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddSolution

PowerShell ISE is started with 'run as other user' and the SharePoint system account is keyed in.

Any suggestions - please.

September 21st, 2010 5:29pm

I think you're probably doing this, but I wanted to check it first. Are you using the SharePoint 2010 Management Shell shortcut to open PowerShell, or are you just opening it directly. If you're doing the latter, you'll want to run the following CMDLET first to make sure the SharePoint CMDLETs are loaded:

  • Add-PSSnapin Microsoft.SharePoint.Powershell

The next thing to check, and I would bet this is your issue, is to see if your account has been granted SharePoint Shell Administrator rights in the environment. I did a blog post about this a while back (http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/06/hey-scripting-guy-tell-me-about-permissions-for-using-windows-powershell-2-0-cmdlets-with-sharepoint-2010.aspx ) b/c it has bitten me on a couple of occasions. Try running Get-SPShellAdmin to see what rights your account has in the environment and its configuration database. If you don't have rights, have someone who does have these rights in your farm to run Add-SPShellAdmin for your user account without specifying a database so that you'll get access to the farm's configuration database and be able to deploy those solutions to it.

If that doesn't work, let us know and we'll see if we can come up with something else.

John

Free Windows Admin Tool Kit Click here and download it now
September 21st, 2010 7:03pm

Hi,

we have the exact same issue (...Add-SPSolution : Access denied. At line:1 char:15...). The user is listed as a SPShellAdmin.

Do you have any other ideas?

Thanks

Matthias

September 24th, 2010 11:16am

ok, sometimes it just helps to post a comment...sorry...
solution: when i open the power shell via right click and "run as administrator" it works, although the domain account is member of the local administrator group.

Thanks anyway
Free Windows Admin Tool Kit Click here and download it now
September 24th, 2010 11:32am

Did you find answer to this problem?
March 5th, 2011 11:15pm

In addition to what John said above, I found out that if you try to Run As a Different User, which not uncommon because you try to run as the farm admin account, this will always result in Access Denied, even if the farm admin has shell admin access.  Same if you try to stsadm -o addsolution this way. 

The solution is to ad the farm account to local server admin group, then the error will go away.  Deploying solutions typically puts files in the 14 hives and assemblies in GAC, so Server Admin access is almost a must have.

Hope this helps.



Free Windows Admin Tool Kit Click here and download it now
April 11th, 2011 6:43pm

Does the farm account also have to be in the local server admin group of SQL Server for this to work? The WFE and SQL are on two different servers.

The farm account has local admin access to the WFE just not SQL.

December 21st, 2011 9:56pm

Run SharePoint 2013 Management Shell as administrator
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2015 9:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics