SharePoint 2010: Get SharePoint 2010 Product SKUs using PowerShell CmdLet - Part 3

This post is continuation to my previous post on SharePoint 2010 Product SKUs. I have written a nifty PowerShell cmdlet to return installed SharePoint 2010 Product SKU - Hope this helps someone, if there are any defects, please let me know -



 <#
.SYNOPSIS
    Prints installed SharePoint 2010 SKUs
.DESCRIPTION
    PowerShell CmdLet Utility for returning installed SharePoint 2010 SKUs
.EXAMPLE
    .\Get-SPEdition.ps1
.NOTES
     Author     : RamakrishnaRaja
.LINK
    http://www.SharePointDeveloper.in
#>


[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")



function Get-SPEdition()
{

# Get the SP Farm using SP PowerShell Cmdlet - Get-SPFarm

    $SharePointFarm = Get-SPFarm

    $InstalledProduct = "None"
     
    #SharePoint 2010 Enterprise Edition SKU

    $Enterprise = "D5595F62-449B-4061-B0B2-0CBAD410BB51"
 
    #SharePoint 2010 Enterprise Edition Trail SKU
 
    $EnterpriseTrial = "88BED06D-8C6B-4E62-AB01-546D6005FE97"
 
    #SharePoint 2010 Standard Edition SKU
 
    $Standard = "3FDFBCC8-B3E4-4482-91FA-122C6432805C"
 
 
    #SharePoint 2010 Standard Edition Trial SKU
 
    $StandardTrial = "B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0"


#SharePoint 2010 Foundation Edition
 
$Foundation = "BEED1F75-C398-4447-AEF1-E66E1F0DF91E"

    $ProductEdition = $SharePointFarm.Products;


foreach ($productEdition in $ProductEdition)
{
$productEdition = $ProductEdition.ToString()
   
if ($productEdition -eq $Enterprise)
{
$InstalledProduct = "SharePoint 2010 Enterprise Edition"
}

if ($productEdition -eq $EnterpriseTrial)
{

$InstalledProduct = "SharePoint 2010 Enterprise Trial Edition"
}

if ($productEdition -eq $Standard)
{

$InstalledProduct = "SharePoint 2010 Standard Edition"
}

if ($productEdition -eq $StandardTrial)
{
$InstalledProduct = "SharePoint 2010 Standard Trial Edition"
}
     
        if ($productEdition -eq $Foundation)
{
$InstalledProduct = "SharePoint 2010 Foundation Edition"
}

}

return $InstalledProduct
}


 $SharePointProductEdition = Get-SPEdition
 Write-Host $SharePointProductEdition

Comments