title: Set the Defaultvalue for a site column in SharePoint using Powershell
body: <p>I am trying to set the default value for a site column.
  I found following code to set the default value of a column in library, but I could not find a way to set the site column using MetadataDefaults</p>
  <pre><code>    add-pssnapin microsoft.sharepoint.powershell -ea silentlycontinue
  [Reflection.Assembly]::LoadwithPartialName(&quot;Microsoft.Office.DocumentManagement&quot;)
  
  $web = get-spweb http://mysitecoll/sites/Nate
  $lib = $web.Lists[&quot;Shared Documents&quot;]
  
   $metadataDefaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults -ArgumentList $web
  
  foreach ($oneFolder in $lib.Folders) {
      Write-Host (&quot;Folder: {0}&quot; -f $oneFolder.Url)
      $folderObject = $web.GetFolder($oneFolder.Url)
      $folderDefaultValue = $metadataDefaults.GetFieldDefault($folderObject, &quot;ColumnName&quot;)
      Write-Host (&quot;  Default Value: {0}&quot; -f $folderDefaultValue)
  }
  </code></pre>
  <p>$web.dispose()</p>
  <p>Help reference for Metadata Default members
  <a href="https://msdn.microsoft.com/EN-US/library/office/microsoft.office.documentmanagement.metadatadefaults_members.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/EN-US/library/office/microsoft.office.documentmanagement.metadatadefaults_members.aspx</a></p>
  <h1>above code taken from <a href="http://blogs.technet.com/b/okoestner/archive/2011/12/01/fetch-default-values-of-folders-with-powershell.aspx" rel="nofollow noreferrer">http://blogs.technet.com/b/okoestner/archive/2011/12/01/fetch-default-values-of-folders-with-powershell.aspx</a></h1>