#Created by P. Sukus #Modified by D. Dill #Name: mobile users syncing through OWA audit #set the timeframe to audit in days $Daysold = 1 $Date = (get-date).adddays(-$daysold) $servers = "server1", "server2", "server3" foreach ($s in $servers) { Write-host -ForegroundColor Blue "Checking server $s for files from the last $daysold day(s)" $logfiles += gci -path \\$s\c$\inetpub\logs\LogFiles\W3SVC1 | where {$_.LastWriteTime -gt $date} } Foreach ($l in $logfiles) { Write-host "Processing "$l.fullname Copy-item $l.fullname -Destination $pwd.path $palmusers += gc $l.name | where {$_ -match "DeviceType=Palm"} $iphoneusers += gc $l.name | where {$_ -match "DeviceType=iPhone"} Remove-Item $l.name } $iuser = @() $puser = @() foreach ($l in $iphoneusers | where {$_ -ne $null}) { $u = $l.split(" ")[7] if ($iuser -notcontains $u) { $iuser += "$u" } $u = $null } foreach ($l in $palmusers | where {$_ -ne $null}) { $u = $l.split(" ")[7] if ($puser -notcontains $u) { $puser += "$u" } $u = $null } $body = "" $body += "" $body += "
" $body += "| iPhone Users |
| $y |
| Palm Users |
| $y |