Hi,
Thanks for looking (sorry if this posted in the wrong forum!).
I need to get some information from AD/Exchange, what I need to pipe the get-aduser command to get-mailboxstatistics
The information I need is:
SamAccountName, DisplayName, , lastlogintime, EmployeeID, Office, CanonicalName, MailboxSize.
Been trying to get the following working then export to CSV
$users = Get-adUser TestAccount -properties *$users | Foreach-Object{
$user = $_
$stats = Get-MailboxStatistics $user
New-Object -TypeName PSObject -Property @{
FirstName = $user.FirstName
LastName = $user.LastName
SamAccount = $user.SamAccountName
Department = $user.Department
EmployeeID = $user.employeeID
EmployeeNumber = $user.employeenumber
Division = $user.Divison
Office = $user.Office
OU = $user.canonicalname
Email = $user.mail
Mobile = $user.mobilePhone
LastLogon = $user.lastlogondate
MailboxSize = $stats.TotalItemSize
ItemCount = $stats.ItemCount
}
}
Any help would be great! Thank you
- Edited by SaintsDT Saturday, April 25, 2015 6:38 PM