Get All SharePoint Server Details (Server Name, IP, Role, Status, etc) in the Farm using PowerShell

Requirement: Quickly retrieve and document details all server in the SharePoint Server farm.

Solution: Get all servers in SharePoint farm

To get all Servers in SharePoint farm, We use: Get-SPServer cmdlet.

Get-SPServer

Lets include Server Name, Role and Status fields from SharePoint farm servers

#Get All Servers in SharePoint Farm (including SQL Server, SMTP Server, Etc)
Get-SPServer | select Name, Role, Status | Format-table -AutoSize
powershell to list sharepoint farm servers

The above cmdlet retrieves all servers in the SharePoint farm including SQL Server, SMTP Server, etc.  To get only SharePoint Servers we can use:

#Get all SharePoint Servers
$servers = Get-SPServer | where { $_.role -ne "Invalid"}

Lets add one more parameter: IP Address to it.

PowerShell to get all servers in SharePoint farm

#Get all SharePoint Servers
$servers = Get-SPServer | where { $_.role -ne "Invalid"}
#Get Server Details including IP
$servers | select Name, Role, @{Label="IP Address";Expression={[System.Net.Dns]::GetHostByName($_.Name).AddressList.IPAddressToString}} | Format-Table

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Get All SharePoint Server Details (Server Name, IP, Role, Status, etc) in the Farm using PowerShell

  • what a lovely command:

    $servers | select Name, Role, @{Label=”IP Address”;Expression={[System.Net.Dns]::GetHostByName($_.Name).AddressList.IPAddressToString}} | Format-Table

    🙂

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *