Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Using Windows Search Index to search for PST files

$
0
0

Hi All,

I have the following script that searches for PST files across all connected drives and lists them in a datagridview

function Get-PSTInfo {
$statusbar.text = "Searching "
$array = New-Object System.Collections.ArrayList
$Script:pstinfo = Get-PSDrive -PSProvider "filesystem"|%{get-childitem $_.root -include *.pst -r}|select name, fullname, @{name="Size (GB)";expression ={"{0:N2}" -f ($_.length/1GB)}} 
$array.AddRange($pstinfo)
$dataGrid1.DataSource = $array
$dataGrid1.autosize = $false
$form1.refresh()
$statusbar.text = "Finished Searching"
$array|Export-Csv c:\temp\pstfound.csv -notypeinformation
}

This takes about 45 minutes to run when tested and I wanted to know if it is possible to use the search index to speed this up as that brings up the same results in about 30 seconds.

I have had a look around and the examples I can see don't seem to work for me

Can anyone help?

TIA

Andy


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>