PowerShell Script to list services running on all servers in a farm
I have written the following script to list the services running on each server in a SharePoint farm and their status, utilising the Get-SPServer cmdlet.
<# --------------------------------------------
SharePoint 2010 PowerShell script to list the
services running on each server in a farm.
File : ListServices.PS1
Author : David Webb
Date : 19/10/2013
Version : 1.0
Revision history:
-----------------
1.0 Initial version
--------------------------------------------- #>
# -------------
# Set variables
# -------------
$Servers = Get-SPServer
# ------------
# Begin script
# ------------
ForEach ($Server in $Servers)
{
Write-Host "Services running on" $Server.Name "..."
$Table = New-Object System.Data.DataTable "$Server.Name"
$Column1 = New-Object System.Data.DataColumn "Service",([String])
$Column2 = New-Object System.Data.DataColumn "Status",([String])
$Table.Columns.Add($Column1)
$Table.Columns.Add($Column2)
$Services = $Server.ServiceInstances
ForEach ($Service in $Services)
{
$Row = $Table.NewRow()
$Row.Service = $Service.TypeName
$Row.Status = $Service.Status
$Table.Rows.Add($Row)
}
$Table | Format-Table –AutoSize
}
And here is a screenshot of the script in action:
Feel free to copy the code and use the script as you see fit (at your own risk of course, I can not and will not take responsibility for any undesired outcome).
![[BlogBookmark]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/blogbookmark.png)
![[Blogsvine]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/blogsvine.png)
![[del.icio.us]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/furl.png)
![[Google]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/linkedin.png)
![[MySpace]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Twitter]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](https://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/email.png)