Script Needed for Exchange Data

Hello - I need a script that will pull data from Exchange Server Databases, the output needs to have:  Name / Title / Telephone Number / E-mail Address. Is that possible?

Also, can this script be run against a list of names? If so, what format do the names have to be? Last, First / First Last / Username?

Thanks
vhaperbaugubAsked:
Who is Participating?
 
Habeebmast7Connect With a Mentor Commented:
The attached script has more than what you have asked.
copy and past the code to the Notepad and save it with .ps1 extension. eg. userproperties.ps1

    Launch PowerShell
    Navigate to the directory where the script is saved.
    PS> cd C:\Scripts (enter)
    Execute the script:

    PS> .\userproperties.ps1.ps1 (enter)

If you receive any errors on the script not being signed....You would have run this command on PS
Set-ExecutionPolicy unrestricted

If your environment is large and you would want to check the output for few users....change the second line in the script as below:

foreach ($Mailbox in Get-Mailbox -ResultSize 50)

Welcome to Powershell......it makes life easy for a Win Admin
- Habz
$AllUsers = @() 
foreach ($Mailbox in Get-Mailbox -ResultSize Unlimited Habeebuddin.Khaja )
    { 
$DisplayName = Get-Mailbox $Mailbox
$EmailAddress = Get-Mailbox $Mailbox |select-object @{label = "emailaddresses";expression = {[string]$_.emailaddresses}}
$TotalItemSize = Get-MailboxStatistics $Mailbox
$Title = Get-User $Mailbox
$ActiveSync = Get-CasMailbox $Mailbox
$DeviceCount = Get-ActiveSyncDeviceStatistics -Mailbox $mailbox |Measure-Object
$LastSynctime = Get-ActiveSyncDeviceStatistics -Mailbox $mailbox | Sort-object LastsuccessSync -descending | Select -first 1
$ReturnedObj = New-Object PSObject 
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $DisplayName.displayname
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $DisplayName.SamAccountName
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "PrimarySMTPAddress" -Value $DisplayName.PrimarySMTPAddress
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "Title" -Value $Title.Title
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "Phone" -Value $Title.Phone
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "ServerName" -Value $DisplayName.ServerName
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "Database" -Value $DisplayName.Database
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "OrganizationUnit" -Value $DisplayName.OrganizationalUnit
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "AccountStatus" -Value $DisplayName.ExchangeUserAccountControl
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "TotalItemSize(MB)" -Value $TotalItemSize.totalitemsize.Value.ToMB()
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "LastLogonTime" -Value $TotalItemSize.Lastlogontime.Date
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "EmailAddresses" -Value $EmailAddress.emailaddresses
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "ActiveSyncEnabled" -Value $ActiveSync.ActiveSyncEnabled
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "EASDeviceCount" -Value $DeviceCount.count
$ReturnedObj | Add-Member -MemberType NoteProperty -Name "LastSuccessSync" -Value $LastSynctime.LastSuccessSync.Date
    $AllUsers += $ReturnedObj 
}

$bodydetail = $allUsers 
$bodydetail | Export-Csv -NoTypeInformation "c:\UserMbxPropertis_$((get-date).toString('yyyyMMdd')).csv"

Open in new window

0
 
PradeepCommented:
can use get-mailboxstatistics cmdlet and username pipeline FL.
0
 
PradeepCommented:
Get-Mailbox cmdlet will give mailbox objects and attributes.
0
 
vhaperbaugubAuthor Commented:
What would the script look like?
0
 
vhaperbaugubAuthor Commented:
Can you include in your script Users Mailbox Size? Deleted Items Size? etc.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.