Friday, December 6, 2013

Get 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.

Lets include Server Name, Role and Status fields
#Get All Servers in SharePoint Farm (including SQL Server, SMTP Server, Etc)
Get-SPServer | select Name, Role, Status | Format-table -AutoSize
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

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...