Tuesday, January 19, 2021

SharePoint build version using PowerShell

In this blog post will discuss about how to get the Sharepoint build version from PowerShell script.

Before that there are many ways we can get the Sharepoint build version, this is one of the reliable way to get the build version.

We can get build version using SQL queries but as per MS recommendation we should avoid connecting to Sharepoint DB, in a way we can avoid using this

Another way is using file system, again its not reliable about the build version we can get which version of Sharepoint like is it 2010, 2013 or etc. Using the Microsoft.Sharepoint.dll version number located in respective folder we can get but there will be always chance the number will vary depending Service Pack or CU updates

Using Registry we can find the build number but again this is not reliable as CU update doesn't reflect the build number in Registry hence we can't use this.

Another reliable way is using Sharepoint central administration, from their we will get the version exact version of the Sharepoint product installed.

As scope of this post is PowerShell we will use PS to get the Sharepoint installed version.

Note: Before going through the please go through my first post in power shell series which convers how to use PS scripts.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
get-spfarm | select BuildVersion

Or simply we can use

(Get-SPFarm).BuildVersion



No comments:

Post a Comment