edit created by column using power shell RRS feed

  • Question

  • I wrote the following script to update the created by column of the documents in one of my document libraries:

    Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
    $SPWeb = Get-SPWeb "";
    $SPList = $SPWeb.Lists[""]
    $userName = "";
    $user = Get-SPUser -web $SPWeb -Identity $userName;
    $userString = "{0};#{1}" -f $user.ID, $user.UserLogin.Tostring()
    $SPListItemCollection = $SPList.Items

    foreach ($ListItem in $SPListItemCollection)


    $ListItem["Author"] = $userString;

    The script runs successfully but when viewing the metadata from the browser I noticed the values don't get updated

    Any ideas ?

    Wednesday, November 11, 2015 12:10 PM

All replies

  • hi

    insert in the loop


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, November 18, 2015 2:51 PM