Update Created By (Author) column of SharePoint document using PowerShell

Posted on : Fri, 5th Feb 16 08:06 am UTC
100+ votes

Modify the Created By (Author) site column using PowerShell script

Below script will update the "Created By" site column (also known as document Author) of a SharePoint document or list item.
Note - This requires updating the Author and Editor attributes both.

$spWeb = Get-SPWeb -Identity "http://sharepoint_site_url"
$spList = $spWeb.Lists["Shared Documents"]
$spItem = $spList.GetItemById(1)

$SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue($SPWeb,1, "LastName, FirstName")

$spItem["Author"] = $SPFieldUserValue
$spItem["Editor"] = $SPFieldUserValue

Make sure you specify the user Name correctly.

Code2care's mission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.

Follow us : Facebook - Twitter - Google +