using powershell script how to sort a list column before update a list item.

here i created a document library and uploaded some documents and want to update ProcessNo column based on Created-Seconds column, so how i sort created-Seconds column in Dec order and update processno.

like : old documents the processno should start from 1.

2/3/2015 1 3/4/2015 2

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

$webURL = "http://tspmcwfe:91" $listName = "Courts"

Get the SPWeb object and save it to a variable

$web = Get-SPWeb $webURL

$list = $web.Lists[$listName] 
$items = $list.items

Go through all items

foreach($item in $items)


$item["ProcessNo"] = 1



value. enter image description here


The loop should be like this

foreach($item in $items) {
    $item["ProcessNo"] = 1

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.