I need to add five new columns to existing SharePoint 2010 libraries using powershell.

I am using below script:

$ver = $host | select version 
if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"} 
if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0)) 
Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell" 
Add-PSSnapin Microsoft.SharePoint.PowerShell 

$SourceWebURL = "http://sitecollection/sites/site" 
$SourceLibraryTitle = "libraryName" 

$ssite = Get-SPSite $SourceWebURL
$sweb = $ssite.OpenWeb("subsite")

#$sWeb = Get-SPWeb $SourceWebURL 
$sList = $sWeb.Lists | ? {$_.Title -eq $SourceLibraryTitle} 

$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text

Column is getting created but it is not showing in the library

  • Can you share more details ? What's the error message ?
    – KhalilG
    Commented Mar 12, 2015 at 9:45
  • Please review my updated code
    – Aquarius24
    Commented Mar 12, 2015 at 10:00

1 Answer 1


I have tested your script and the column has been added successfully. The only thing that I has to do is to add the column to the current view. Check in your list settings that the column has been added. If you want to add the column automatically to the current view, you can add this to the end of your script :

# Get current view
$view = $sList.DefaultView

$newColumn = $sList.Fields["YourColumn"]

# Delete if already exist



# Add column


  • Please Indicate "Mark as Answer" if the has Answered the Question
    – KhalilG
    Commented Mar 12, 2015 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.