Get SharePoint 2010 version with PowerShell

As part of the summary script I use the following code to get the SharePoint 2010 version. This identifies which CU or Service Pack has been installed.

There are a couple of ways for getting the build version:

1. Using Central Administration

It is of course possible to get the build version using central administration by going to ‘Central Administration –> System Settings –> Manage servers in this farm’

image

2. Using get-spfarm

You can use the following line of code to get the buildversion

get-spfarm | select BuildVersion

image

3. Using [Microsoft.SharePoint.Administration.SPFarm]::Local

This command outputs the same values as get-spfarm.

([Microsoft.SharePoint.Administration.SPFarm]::Local).buildversion

image

Use .tostring() to get the version as string.

image