I am working on SharePoint server 2013, and I wrote the below script to copy items from one list to another list along with the original item versions.

    $web = get-spweb "http://server/Delivery/"
    $web2 = get-spweb "http://server/Support"
    $list = $web.lists["Action"]
    $list2 = $web2.lists["Tracking"]
    foreach ($i in $list.items)
    $a = $i["ID"];
    $sourceItem = $list.items.GetItemById($a)

    $versions = $sourceItem.versions;

    $newItem = $list2.items.Add();

    $versionCount = $versions.Count;

    ##We need a for loop here as we must work backwards through the version collection
    for ($i = $versionCount;$i -gt 0;$i--)
        $version = $versions[$i-1];

    $newItem["Title"] = $version["Title"];
    $newItem["Modified"] = $version["Modified"];
    $newItem["Editor"] = $version["Editor"];
    $newItem["Author"] = $version["Author"];
    $newItem["Created"] = $version["Created"];
    $newItem["Comment"] = $version["Comment"];
    $newItem["Comments"] = $version["Comments"];
    $newItem["DueDate"] = $version["DueDate"];
//other field goes here..



now the above script was able to copy the items from the list into list2, along with the original item versions. but the problem I am facing is that I got this extra modification which I do not want to have:-

  • on the copied item, it will have its modified date = Today date (the date which I run the above script)

  • and there will be a new version created for the copied item and the modified by the username of this version will be the system account which runs the above script.

so can anyone advice how I can copy the item without adding a new version and affecting the modified date and modifiedBy fields? so I will get an exact copy of the original item?


May be what you're looking for.

If necessary you can also use $newItem["Modified"] = $sourceItem["Modified"]

  • did you try using $newItem.UpdateOverwriteVersion()? as in my case using $newItem.UpdateOverwriteVersion() will not be able to copy versions and at the same time it will change the modifieddate and modfiedby fields !!! so $newItem.UpdateOverwriteVersion() is even worst in my case compared to $newItem.Update(); – john Gu Jul 6 '16 at 13:58
  • @Robert now i try using $newItem.SystemUpdate($false); this caused no new version to be created ,, but the comments were not copied and the modifieddate and modifiedby were changed !! – john Gu Jul 6 '16 at 14:09
  • Hi John, I don't have a system to test this stuff on at the moment unfortunately. Perhaps you need to do your original copy, then copy over the original Modified, ModifiedBy columns and call SystemUpdate. Then delete the new version you don't want: social.technet.microsoft.com/wiki/contents/articles/… – VB Did Nothing Wrong Jul 6 '16 at 14:16
  • @ButttDrivendevelopmeny but i also have a feeling that deleting a version will update the modified date and modified by !! so i will be in the same cycle... now i am sure that using $newItem.Update(); is the correct way to do things as it will enable to create versions.. but not sure how i can prevent it from adding extra version that result from running the powershell. – john Gu Jul 6 '16 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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