Problem: Getting “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))” on running PowerShell cmdlets, such as: Get-SPWeb, New-SPUser, Get-SPUser, Set-SPUser, etc.
Add a web application user policy with Full control for the Farm Administrator who runs the Script!
- Open SharePoint 2016/2013/2010 Central Administration site as a Farm Administrator
- Click Application Management >> Select Manage Web Applications.
- Select your target web application >> Click the User Policy button from the ribbon.
- From the Policy for Web Application dialog box, click on “Add Users” link.
- Select All Zones for the web application and click on Next
- Enter the user account and Select the permission policy level as “Full Control”
- Click Finish to save your changes.