Created
April 22, 2014 20:45
-
-
Save babadofar/11193668 to your computer and use it in GitHub Desktop.
Windows System Email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ([Parameter(Mandatory=$true)][string]$query) | |
$con = New-Object -TypeName System.Data.OleDb.OleDbConnection | |
$con.ConnectionString = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';" | |
$con.Open() | |
$cmd = $con.CreateCommand() | |
$query = "SELECT Top 5 System.ItemPathDisplay FROM SYSTEMINDEX WHERE contains(*, '$($query)*') AND System.Kind = 'email'" | |
$cmd.CommandText = $query | |
$rdr = $cmd.ExecuteReader() | |
while ($rdr.Read()) { | |
Write-Host $rdr[0] | |
} | |
$rdr.Close() | |
$con.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment