/, .
, Select-String -AllMatches. . , .
$sentMail.Items | select -last 10 TaskSubject
10 , , . .
-match , , if blocks where. , . , :
$res = gc $sentMail.Items | ?{$_ -match $matches2 | %{ $_ -match $matches2 | out-null; $matches[1] }
: Get-Content (gc) . Get-Content , $sentMail.Items . . . ?{$_ -match $matches2 | %{ $_ -match $matches2 | out-null; $matches[1] } ... , .
$outlook = new-object -com Outlook.Application
$sentMail = $outlook.Session.GetDefaultFolder(6) # == olFolderInbox
$matches2 = "\d+$"
$sentMail.Items | select -last 10 -ExpandProperty TaskSubject | ?{$_ -match $matches2} | %{$Matches[0]}
10 , $matches2. , .