Wednesday, May 20, 2015

Active Sync Stats

Active Sync Stats

Get-CASMailbox -ResultSize unlimited | where {$_.ActiveSyncEnabled -eq “true”} | ForEach-Object {Get-
ActiveSyncDeviceStatistics -Mailbox:$_.identity} | select Devicetype, DeviceID,DeviceUserAgent, FirstSyncTime,
LastSuccessSync, Identity, DeviceModel, DeviceFriendlyName, DeviceOS | Export-Csv c:\activesync.csv

Powershell script to import size of mailbox in CSV file using Add-Member NoteProperty

Powershell script to import size of mailbox in CSV file using Add-Member NoteProperty


$date = get-date -format d
$date = $date.ToString().Replace(“/”, “-”)
$output = ".\" + "mailboxdata" + $date + "_.csv"
$z = @()
$g = @("guptaa10","rawata")
foreach ($f in $g)
{
$b = Get-Mailbox -Identity $f
$c = Get-MailboxStatistics $f
$object = New-Object -TypeName PSObject
$object | Add-Member NoteProperty –Name User –Value $b.Alias
$object | Add-Member NoteProperty –Name Quota –Value $b.ProhibitSendQuota
$object | Add-Member NoteProperty –Name Size –Value $c.TotalItemSize
$z += $object
}
$z | Export-Csv $output