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

3 thoughts on “Get SharePoint 2010 version with PowerShell

  1. Actually your code doesn’t work complaining about “the term get-spfarm is not recognized”.
    The right code is:

    if(!(Get-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction:SilentlyContinue))
    {
    Add-PSSnapin Microsoft.SharePoint.Powershell
    }

    get-spfarm | select BuildVersion

  2. In some rare occasions the farm might not yet be configured (i.e. you’re just configuring it).
    Then the snapin’s version might be the way to go:
    (get-pssnapin microsoft.sharepoint.powershell).Version.Major

Leave a Reply

Your email address will not be published. Required fields are marked *