none
verify whether the account is farm admin or not in SharePoint RRS feed

  • Question

  • Do we have a PowerShell command to check whether a account is a farm admin account or not?
    Friday, May 22, 2020 4:11 PM

All replies

  • Hi AdithyaDugyala,

    To check SharePoint farm administrators by using below PowerShell.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    
    
    $CAWebApp = Get-SPWebApplication -IncludeCentralAdministration | where-object {$_.DisplayName -eq "SharePoint Central Administration v4"}
    
    
    $CAWeb = Get-SPweb($CAWebApp.Url)
    
     
    
    $FarmAdminGroup = $CAWeb.SiteGroups["Farm Administrators"]
    
      foreach ($Admin in $FarmAdminGroup.users)
    
          {
    
           write-host $Admin.LoginName
    
          }


    Best regards,

    Emily Du


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, June 2, 2020 9:19 AM
  • PowerShell To get Primary Farm Administrator:

    $farm = Get-SPFarm
    $farm.DefaultServiceAccount
    $farm.DefaultServiceAccount.Name

    PowerShell to get All Farm Administrators:

    $ca = Get-SPWebApplication -IncludeCentralAdministration | ? IsAdministrationWebApplication
    $site = $ca.Sites["/"]
    $web = $site.RootWeb
    $group = $web.SiteGroups["Farm Administrators"]
    $group.Users

    • Proposed as answer by Muppavarapu Thursday, June 25, 2020 1:15 PM
    Thursday, June 25, 2020 1:14 PM