0

I need help pulling every word that contains certain strings(more than one) from particular site and exporting to a file.

My code is as follows:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$loc = 'http://devtest/'
$PathArray = @()

#$Text = 'Proof of Address','PORA', 'Soft Freeze', 'Hard Freeze', 'Soft Freeze','FICA Requirements', 'Account Opening Documents/Requirements', 'Account Management/Requirement'
$Text = "FICA"


$SEL = Select-String -Path $loc -Pattern $Text
if($SEL -ne $null)
{
    $PathArray += $SEL
    $PathArray | Export-CSV "C:\SearchFica.txt" -Delimiter "|" -NoTypeInformation
}

But I'm getting the the following error:

Select-String : Cannot find drive. A drive with the name 'http' does not exist.

0

If you want to work with SharePoint in PowerShell you need to use this module.

Hope it helps!

  • @Zdenek I added the module if you look closely to my code. can you please give me example of how you would change my code to accommodate the second point in your answer. – Vusi85 Feb 21 at 7:57
  • and what you exactly need? Where must be these strings for saving them? In documents titles? List records names? or ? I dont understand where you are searching them (you want to search them) – Zdeněk Vinduška Feb 21 at 8:11
  • I'm searching an entire site looking for all those strings and taking the result to a text file. I want anything that contains any of those strings in a particular site, ie picture, url, docs, etc. – Vusi85 Feb 21 at 8:22
  • Thats so complex solution, maybe you should try use Search Results for this because it crawl all content. But not navigation text, maybe you need to create complex solution (I dont expect that somebody will write the whole solution for you here) or try use Search Index or some IRM or Audit functions. <br><br>Because you need to search in navigation, titles, list records, documents (fulltext included?) – Zdeněk Vinduška Feb 21 at 8:27
  • I thought it could be easy because all you have to do is search a string match in a particular site. bur I'm relatively new in powershell. I though someone could have a solution. is that not possible in powershell?? – Vusi85 Feb 21 at 8:29
0

-Path will look for the local drives. Try using the -InputObject to specify the string values.

The detailed Microsoft documentation can be found here

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.