List SharePoint Services on Server using PowerShell

Manage Services on Server shows which SharePoint service is running on a particular server. You can only select 1 server and you won’t get a quick overview of all the services per server. I have created the below script to create a .html file which shows each server and their active or inactive service.

The following script can be copied into notepad and saved as a .ps1 file. Just execute the script to create a .HTML file. When you run the script, it will ask for an export location. This folder does not have to exist on your harddrive. This has been created and tested for SharePoint 2013 and haven’t tested this yet for SharePoint 2010.

#Import SharePoint PowerShell Modules
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Request the location to store the HTML file
$ExportLocation = Read-Host "Enter the location to store the HTML file. (eg. C:\temp). This directory will be created if it doesn't exist"

Function ListServicesOnServer($path)
#Check if directory exists or create the directory
if((Test-Path $path) -eq $false)
mkdir $path
write-host "Folder created" -foregroundcolor yellow
write-host "Folder already exists" -foregroundcolor yellow

#create an unique name
$date = get-date
$today = $date.ToString("ddMMyyyy_HHmm")
$HTMLpath = "$($path)\ServicesOnServer_$($today).html"

#Create HTML File for the information
New-Item -ItemType file $HTMLpath -force | out-null
add-content -value "<html><body><h1>Services on Server</h1><br />" -path $HTMLpath

#Try / Catch statement to get the information
#Get the SharePoint servers in the farm
$servers = Get-SPServer | where {$_.Role -ne "Invalid"}

#Create an HTML Table and headers
add-content -value "<table border='1' style='font-family: Calibri, sans-serif'>
<th style='background-color:blue; color:white'>Service</th>" -path $HTMLpath
$servers | %{Add-Content $HTMLpath "<th style='background-color:blue; color:white'>$($_.Address)</th>"}
add-content -value "</tr><tr>" -path $HTMLpath

#list all services using 1 server
$services = get-spserviceinstance -server $servers[0]

foreach($service in $services)
$serviceTypeName = $service.TypeName | sort-object
Add-Content $HTMLpath "<td>$($service.TypeName)</td>"
$servicesOnServers = get-spserviceinstance | where-object {$_.TypeName -eq $serviceTypeName} | %{Add-Content $HTMLpath "<td>$($_.status)</td>"}
Add-Content $HTMLpath "<tr></tr>"

add-content -value "</table></body></html>" -path $HTMLpath
write-host "Script Done" -foregroundcolor green
write-host "$($_.Exception.Message)" -foregroundcolor red



You should already have created a .ps1 file and saved this to a predefined location:


Run PowerShell as administrator and run the following command:

& “C:\Temp\ListServicesOnServer.ps1”


Press enter and fill in a location:


Press enter:


The output should look like below:


Set SharePoint cache accounts with PowerShell

The object cache stores properties about items in SharePoint Server 2010/2013. Items in this cache are used by the publishing feature when it renders web pages. The goals of the object cache are to reduce the load on the computer on which SQL Server is running, and to improve request latency and throughput. The object cache makes its queries as one of two out-of-box user accounts: the Portal Super User and the Portal Super Reader (SharePoint cache accounts). These SharePoint cache accounts must be properly configured to ensure that the object cache works correctly. The Portal Super User account must be an account that has Full Control access to the web application. The Portal Super Reader account must be an account that has Full Read access to the web application.

You can use the below script to automatically grant the cache accounts the required permissions and add these for all web applications.

$webapps = Get-SPWebApplication
$SuperUserAcc = “i:0#.w|peet\sp2013_superuser”
$SuperReaderAcc = “i:0#.w|peet\sp2013_superreader”
foreach($webapp in $webapps)
[Microsoft.SharePoint.Administration.SPPolicyCollection]$policies = $webapp.Policies
[Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($SuperUserAcc, "Super User (Object Cache)")
[Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $webapp.PolicyRoles | where {$_.Name -eq "Full Control"}
[Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($SuperReaderAcc, "Super Reader (Object Cache)")
[Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $webapp.PolicyRoles | where {$_.Name -eq "Full Read"}
$["portalsuperuseraccount"] = $SuperUserAcc
$["portalsuperreaderaccount"] = $SuperReaderAcc