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 - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time 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 *