Add A SharePoint Server Farm Admin Farm-Wide

Add A SharePoint Server Farm Admin Farm-Wide

  •  
  •  
  •  
  •  
  •  
  •  

I was installing a new SharePoint Server 2019 farm and after applying all updates and configuring the SharePoint Products Wizard, I restarted my servers a final time and logged on, only to find that I couldn’t access the SharePoint Products Wizard anymore.

I was receiving an “Access Denied” error when trying to connect to the SharePoint Configuration Database.  After scratching my head for a while, I realized I had added a  local account to the Farm Administrator instead of my  domain account.

Fortunately, there was a reasonably easy fix.  We’ve got it documented at https://docs.microsoft.com/en-us/powershell/module/sharepoint-server/add-spshelladmin?view=sharepoint-ps, but of course, there’s stuff that we leave out.  This is how I solved that problem.

  1. Launch SharePoint Management Shell using RunAs Other User and enter the credentials of a current farm administrator (in this case, my local account).
  2. Copy/paste this bad boy:
    Function New-FarmAdmin ([string]$Identity,[switch]$IncludeAllContentDatabases)
    {
       $CentralAdminWebApp = Get-SPWebApplication –IncludeCentralAdministration | ? {$_.DisplayName –like "SharePoint Central Administration*"}
       New-SPUser –UserAlias $Identity –Web $CentralAdminWebApp.URL –Group "Farm Administrators"
       $CentralAdminContentDB = Get-SPContentDatabase –WebApplication $CentralAdminWebApp
       Add-SPShellAdmin -Database $CentralAdminContentDB -Username $Identity
       If ($IncludeAllContentDatabases)
       { 
          $ContentDatabases = Get-SPContentDatabase
          Foreach ($Database in $ContentDatabases) 
             {
             Add-SPShellAdmin -Database $Database -Username $Identity
             }
       }
    }
  3. Run New-FarmAdmin -Identity <DOMAIN\Username> -IncludeAllContentDatabases
  4. Celebrate.  Beer optional.

Happy Farming!

 

Published by Aaron Guilmette

Helping companies conquer inferior technology since 1997. I spend my time developing and implementing technology solutions so people can spend less time with technology. Specialties: Active Directory and Exchange consulting and deployment, Virtualization, Disaster Recovery, Office 365, datacenter migration/consolidation, cheese.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.