Forum Discussion

dklbwf's avatar
dklbwf
Copper Contributor
Oct 21, 2022

Powershell script to update multiple items from ID field

Hello, I have a request for 2 SharePoint 2013 OnPrem list where they are needing 1,000 records in both lists to simply have the status updated to completed and comment added for specific records.  O...
  • NicolasKheirallah's avatar
    Oct 23, 2022
    dklbwf try this 🙂 

     

     

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
     
    #Variables
    $SiteURL = "http://siteaddress/"
    $ListName = "vr"

    $List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)
    $ItemIDs = 17148, 17147

        foreach($ItemID in $ItemIDs)
    {

        $SPListItem = $List.GetItemByUniqueId($ItemID)
        $ListItem["Status"]="Completed"
        $ListItem["Request Comment"]="Completed 10-21-2022"    
        $SPListItem.Update()
    }

     

     

Resources