Check if a Service Application is Running in SharePoint using PowerShell
If you are a SharePoint administrator, then there may be times when you need to check if a service application is running. In my case, A couple of times, I had to get the service application’s status before performing activities such as: Stop and Starting the service, monitoring the service application’s availability, etc. This blog post will show you how to use PowerShell to check if the Service Application is running (or not) in SharePoint.
PowerShell script to check service application’s status:
Here is how we can check if the service application is created and running using PowerShell.
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
#Display Name of the Service Application
$DisplayName="Managed Metadata Services"
#Get the Service Application from its Name
$ServiceApp = Get-SPServiceApplication | Where { $_.DisplayName -eq $DisplayName}
if($ServiceApp -ne $null)
{
#get the Service application status
$ServiceApp.Status
}
else
{
Write-Host "Service application either not found or not created!"
}
This script gives the service application’s current status. You can also get a service application from its type. Here is how:
#Type Name of the Service Application
$TypeName="Managed Metadata Service"
#Get the Service Application from its Type Name
$SeviceApp = Get-SPServiceApplication | Where {$_.TypeName -eq $TypeName}
Here is the Type Name of all service Applications:
Type Name |
Access Services Web Service Application |
Access Services 2010 Web Service Application |
App Management Service Application |
Application Discovery and Load Balancer Service Application |
Business Data Connectivity Service Application |
Excel Services Application Web Service Application |
Machine Translation Service |
Managed Metadata Service |
PerformancePoint Service Application |
PowerPoint Conversion Service Application |
Search Administration Web Service Application |
Search Service Application |
Secure Store Service Application |
Security Token Service Application |
State Service |
Usage and Health Data Collection Service Application |
User Profile Service Application |
Visio Graphics Service Application |
Work Management Service Application |
Word Automation Services |