You’ve logged into a farm server with the SharePoint Setup User Administrator account. You’ve opened a SharePoint management shell with elevated privileges. You are attempting to import a document library using the SPWeb object but experience this error:
Import-SPWeb : Cannot find an SPWeb object with Id or URL : <URL>…
This can occur when the account you are logged in as has not been added to the SharePoint_Shell_Access role of the content and/or farm configuration databases. Generally, you want your administrator account to be added to this role for all farm content databases and the farm configuration databases so that you can manage them from a PowerShell.
In the following procedure, you will first get the GUIDs associated with the content databases. Then, you will check each content database and the farm configuration database for the accounts that have had the SharePoint_Shell_Access role added to them. Lastly, you will add the role to the desired account for each database.
- Note down the following information:
- The account you used trying to perform the import that resulted in the error (call it User.Account)
- The name of the content database containing the site into which you wanted to perform the import (call Content_A).
- Login to a SharePoint farm server using the SharePoint Setup User Administrator account.
- Launch an elevated instance of the SharePoint 2013 Management Shell.
- Execute Get-SPContentDatabase. This returns a list of all farm content databases, along with summary information and including the database GUID.
- Note down the content databases and their GUIDs.
- Execute Get-SPShellAdmin <GUID> for each GUID noted in step 5). This will return a list of all user accounts added to the SharePoint_Shell_Access role for that database.
- Note down where the account in step 1) above is missing from the role.
- Execute: Get-SPShellAdmin. This will return a list of all user accounts added to the SharePoint_Shell_Access role for the farm configuration database.
- Execute: Add-SPShellAdmin -UserName DOMAIN\User.Account <GUID> for each content database identified in step 5). Executing this command adds this role for both the content database and for the farm configuration database.
If you experience an error trying to add this role to that account, perform the steps in this reference.
- Repeat step 6) – 8) to verify that the SharePoint_Shell_Access role has now been added to the desired account.
Best SharePoint 2013 Hosting Recommendation
Following reviewed for Best ASP.NET hosting companies that help with SharePoint 2013, ASPHostPortal is Best ASP.NET Hosting Recommendation for SharePoint 2013. They give 99,99% uptime assured, as well as 30 Days Money back assured, superb customer service, and many more.