When executing the Get-SPWeb PowerShell cmdlet as a farm administrator, I received the following error:
Quick and simple fix, Add-SPShellAdmin should have given me enough permissions for executing the command, but I forgot to specify the content database. This is crucial if you want to create PowerShell objects that are existing within these content databases.
Finding the contentdatabase of a web application can be done quickly with Get-SPContentDatabase.
Here’s a sample script that will create a contentdatabase object, which is used as a parameter for the Add-SPShellAdmin cmdlet.
$db = Get-SPContentDatabase -site http://sharepoint Add-SPShellAdmin -UserName SP\SP_User -database $db
The error could’ve been a bit more descriptive than “Cannot find” in my opinion.