Hi experts i am using exchange hybrid environment, i want to pull this report for Office365 users, i am using the below script and it works fine but i want to add FirstName,LastName,Primary email address, Secondary email address, EmployeeID, Job Title, and OWA enabled or disabled to this script. How do i add to this PS1

foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {
$user = $_
$stats = Get-MailboxStatistics $user.Name
New-Object -TypeName PSObject -Property @{
DisplayName = $User.DisplayName
IssueWarningQuota = $User.IssueWarningQuota
ProhibitSendQuota = $User.ProhibitSendQuota
ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota
TotalItemSize = $stats.TotalItemSize
AuditEnabled = $User.AuditEnabled
}
}
}

3 Spice ups

We can use get-user to get firstname , lastname and tltle:

The script should be like this:

$a=get-user $user.name

FirstName=$a.firstname

LastName=$a.lastname

You also can use get-user user| fl to check other info you want.

By that analogy,

Get-mailbox can get the EmailAddresses, it should be like:

EmailAddresses : {SMTP:User5@contoso.com, smtp:User5@jayce.com}

Get-CASMailbox can get OWAEnabled info.

I have added the below two lines in the script but i am not getting , help me how to add email id, employeeid and job titile and owa status to the script

FirstName = $User.FirstName

LastName = $User.LastName

There is no attribute named EmployeeID, please check which attribute you use as EmployeeID.

foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {   
$user = $_
$stats = Get-MailboxStatistics $user.Name
$a=get-user $user.name
$b=Get-CASMailbox $user.name      
New-Object -TypeName PSObject -Property @{       
DisplayName = $User.DisplayName

FirstName = $a.FirstName
LastName = $a.lastname
EmailAddress = $user.EmailAddresses
JobTitle = $a.title
OWAEnable = $b.OWAenabled
IssueWarningQuota = $User.IssueWarningQuota       
ProhibitSendQuota = $User.ProhibitSendQuota       
ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota     
TotalItemSize = $stats.TotalItemSize
AuditEnabled = $User.AuditEnabled                 
} 
}
}

Apart from this, you can refer to Kernel Exchange Reporter tool for a detailed information about Exchange Server. It generates more than 80+ types of reports. To know more about Exchange Reporting tool , visit: Exchange Reporter to Monitor & Generate Reports of Exchange Server Activities

I can see in Active Directory

Active Directory - Find- Advanced -Click Fields-User-Employee ID

i have added the below line in PS1 but i did not get any output

EmployeeID = $user.EmployeeID

That’s because the commands in the script don’t have access to that attribute. I don’t know right off it it’s possible to link over to the user’s AD object and pull more attributes. I would think so though. I would add the powershell tag to your post. Lots of people in that section that can probably help.