Friday, March 31, 2017

How to determine the SharePoint version in PowerShell

# Add the snapin, in case it's not already installed
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$ver = (Get-PSSnapin microsoft.sharepoint.powershell).Version.Major
If ($ver -eq "15" )
    {
        Write-Output "SharePoint 2013 is installed"
        }
    elseif ($ver -eq "14")
    {
        Write-Output "SharePoint 2010 is installed"
        }
        else
        {
            Write-Output "Could not determine version of SharePoint"
            } 

No comments:

Post a Comment