How to Create a Choice Site Column in a SharePoint Site with PowerShell

This time I am sharing a small script that allows to create a choice site column through PowerShell. As you can see, the way to create this type of column is the same as if you use the SharePoint server API in a Console Application program in Visual Studio. You can download the script from the following link: How to create a Choice Site Column in a SharePoint Site!

If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )

{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }

$host.Runspace.ThreadOptions = “ReuseThread”

#Definition of the function that creates a New Site Column in a SharePoint Site.

function Create-SiteColumn


param ($sSiteCollectionUrl,$sFieldDisplayName, $sFieldInternalName, $sFieldType)



$spSite = Get-SPSite –Identity $sSiteCollectionUrl

$spWeb = $spSite.OpenWeb()

#We check the field type is not null

if($sFieldType -ne )


writeHost “Adding the field $sFieldDisplayName to the Site” -foregroundcolor blue



$spChoiceField.Group=”MVP Columns”


$spChoiceField.Choices.Add(“IT Pro”)







#Disposing SPSite and SPWeb objects




catch [System.Exception]


writehost -f red $_.Exception.ToString()



#Calling the function

Start-SPAssignment –Global

$sSiteCollectionUrl = “http://winsrv2012:80/sitios/compartimoss”

$sFieldDisplayName=”MVP Type”



Create-SiteColumn -sSiteCollectionUrl $sSiteCollectionUrl -sFieldDisplayName $sFieldDisplayName -sFieldInternalName $sFieldInternalName -sFieldType $sFieldType

Stop-SPAssignment –Global

Remove-PsSnapin Microsoft.SharePoint.PowerShell