Right now I am looking for a way to run a PowerShell script on a "selected" list item in a sharepoint online list.

Every code snippet I see points to running code on the entire list.

1 Answer 1


Yes, it's normal, there is no relation between the PowerShell and the Selected Items in the list in GUI.

So in your case, you can Use Where clause based on specific criteria to run the PowerShell cmdlet on specific list items on your list.


$listItems = $list.Items| where {$_['column name'] -eq 'True'}

Then for-each for each item in $listItems as the following

$listItems | ForEach-Object {
  • What I am trying to do it use the "copy to" menu option to do this while keeping the reference Item ID intact
    – scottj
    Dec 12, 2017 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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