Wednesday, March 25, 2015

PowerShell script to find a string of characters in office documents in Doc Libraries and List Item attachments?

So you want to find ANY item in a list that contains say the word "Document"?




$SPSite = "http://site"
$ListName = "Library"

$SPWeb = Get-SPWeb $SPSite
$List = $SPWeb.Lists[$ListName]
$test = $list.items

$a = $test |? {$_.Name -like "*Document*"}

$a | select-object Title, Name, DisplayName, File | fl
#this will create a csv file


$a | select-object Title, Name, DisplayName, File | export-csv "c:\temp\tst.csv"









If this is helpful please mark it so. Also if this solved your problem mark as answer.









No comments:

Post a Comment