Forum Discussion
dklbwf
Oct 21, 2022Copper Contributor
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...
- Oct 23, 2022dklbwf try this 🙂Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue#Variables$ListName = "vr"$List = (Get-SPWeb $SiteURL).Lists.TryGetList($ListName)$ItemIDs = 17148, 17147foreach($ItemID in $ItemIDs){$SPListItem = $List.GetItemByUniqueId($ItemID)$ListItem["Status"]="Completed"$ListItem["Request Comment"]="Completed 10-21-2022"$SPListItem.Update()}
dklbwf
Oct 24, 2022Copper Contributor
I am not seeing any error or anything when I run the script above. It does not give me and output either.
ganeshsanap
Oct 26, 2022MVP
dklbwf Are there any item level permissions applied on list items? Make sure user account you are using to run PowerShell has at least Contribute/Edit access to read and update items in SharePoint list.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- dklbwfOct 26, 2022Copper ContributorThat was 100% the issue. I was running the scripts under the wrong account. Once I figured that out script is working 100% correctly.