$ComputersPath = “c:\scripts\folderlist.txt”
$SmtpServer = “”
$SmtpPort =
$to = “”
$from = “”
$sub = “”
$body = @()
$body =
ForEach ($Computer in (Get-Content $ComputersPath))
{ If ($Computer)
{ ForEach ($Drive in “C”,“D”)
{ If (Test-Path "\$Computer$($Drive)`$" -ErrorAction Stop)
{ $Log += ForEach ($OST in ($OSTS = Get-ChildItem "\$Computer$($Drive)`$" -Include *.ost -Recurse -Force -erroraction silentlycontinue))
{ New-Object PSObject -Property @{
ComputerName = $Computer
Path = $OST.DirectoryName
FileName = $OST.BaseName
Size = “{0:N2} GB” -f ($OST.Length / 18gb)
}
}
}
}
}
}
Send-MailMessage -SmtpServer $SmtpServer -Port $SmtpPort -To $to -Subject $sub -Body ($body | ConvertTo-Html -Head $head | Out-String) -From $from -BodyAsHtml