I have a SharePoint site which I want to search all document libraries where column1 = 'hello' and then print out the columns title, scope and column1. Then output the result to a file.

I want to do this in a PowerShell script. I'm not sure how to go about this, this is the start:

Get-SPSite mysite |
Select -ExpandProperty Lists |
Select -ExpandProperty Fields |
Select Name, Scope, Column1 | Out-File test.txt

I am not sure how to do the where clause, I've seen where and where-object, Iäm confused how to do the where clause?


The where clause should be use in this way (this code has not been tested):

Select -ExpandProperty Fields | Where $_.Column1 -eq 'hello' | Select Name, Scope, Column1

BTW your code is wrong because SPSite has not Lists property. That property is in SPWeb

| improve this answer | |

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.