Link to home
Start Free TrialLog in
Avatar of Akash Bansal
Akash BansalFlag for India

asked on

How to get list of MS exchange 2013 / 2016 users enabled for activesync, OWA, MAPI, POP3, IMAP by command line

I am looking for a command that should generate exchange user's details as per the following format:


Exchange 203/2016 Weekly report:

User      Last_logon_time      Total_quota      Used_quota      OWA_mobile      Active_sync      OWA      MAPI      IMAP      POP3      
User1      Date_time      10GB      5GB      Enabled      Enabled      Enabled      Disabled      Enabled      Disabled      
                                                      
User generated image                  


I have tested one command that generates a few things like last logon time, total quota & used quota. Please help for rest of the properties.
                                          

Get-Mailbox | Get-MailboxStatistics | Select DisplayName,LastLogonTime,@{N="Total Item Size (GB)";E={$_.TotalItemSize.value.toGB()}},@{N="ProhibitSendReceiveQuota (GB)";E={(Get-Mailbox $_).ProhibitSendReceiveQuota.Value.ToGB()}}


User generated image
User generated image
Avatar of Saif Shaikh
Saif Shaikh
Flag of India image

Get-CasMailbox -ResultSize Unlimited | ForEach-Object {
if ($_.ActiveSyncEnabled) { $ActiveSync++ }
if ($_.OWAEnabled) { $OWA++ }
if ($_.POPEnabled) { $POP++ }
if ($_.ImapEnabled) { $Imap++ }
if ($_.MapiEnabled) { $Mapi++ }
}
$Count = New-Object psobject
$Count | Add-Member -Name ActiveSyncEnabled -Type NoteProperty -value $ActiveSync
$Count | Add-Member -Name OWAEnabled -Type NoteProperty -value $OWA
$Count | Add-Member -Name POPEnabled -Type NoteProperty -value $POP
$Count | Add-Member -Name ImapEnabled -Type NoteProperty -value $Imap
$Count | Add-Member -Name MapiEnabled -Type NoteProperty -value $Mapi
$Count | ft
Avatar of Akash Bansal

ASKER

Bravo! Thanks for the quick solution.
Get-CasMailbox -ResultSize Unlimited  gives me desirable result.
As I am not from coding background, code next to the pipe did not work for me.

Can we save the result Get-CasMailbox -ResultSize Unlimited  in CSV format? If yes, I will open it to excel straight.
Though manual import of the text file generated by the command Get-CasMailbox -ResultSize is working.


 | export-csv activesync.csv -notype.
ASKER CERTIFIED SOLUTION
Avatar of Saif Shaikh
Saif Shaikh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
[PS] C:\Windows\system32>get-casmailbox |ft PrimarySmtpAddress, SamAccountName, DisplayName, ActiveSyncEnabled, OWAEnabled, OWAforDevicesEnabled, PopEnabled, ImapEnabled >c:\activesync2.txt

is giving desired result but in text format.
But as soon as  I put "|   export-csv c:\activesync.csv -notype" this gives:
 
ClassId2e4f51ef21dd47e99d3c952918aff9cdpageHeaderEntrypageFooterEntryautosizeInfoshapeInfogroupingEntry
033ecb2bc07a4d43b5ef94ed5a35d280


Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo


Try using |   export-csv c:\activesync.csv 

And don't use -notype 

OR

| Export-Csv -nti blabla.csv

Open in new window


Tried  |   export-csv c:\activesync.csv 

with & without  -notype 

&
| Export-Csv -nti blabla.csv


But is giving same result as with 
 " |   export-csv c:\activesync.csv -notype"  



Try

| Export-CSV "C:\MailBoxFeatures.csv" -NoTypeInformation -Encoding UTF8

Open in new window


Same result :(
I found two very good scripts.

Generate Reports for Exchange ActiveSync Device Statistics
https://gallery.technet.microsoft.com/scriptcenter/Generate-Reports-for-59557b49
Get-EASDeviceReport.ps1-1.03

&

Get-MailboxReport.ps1
https://gallery.technet.microsoft.com/scriptcenter/Generate-Mailbox-Size-and-3f408172
Generate Mailbox Size and Information Reports using PowerShell

I wish to create this report that should email weekly.

 
DisplayNameMailbox TypeTotal Mailbox Size (GB)Mailbox Recoverable Item Size (GB)Deleted Items Folder Size (GB)Audit EnabledIssue Warning QuotaProhibit Send QuotaProhibit Send Receive QuotaAccount EnabledLast Mailbox LogonLast Logon IP Adress/city/countryPrimary Mailbox DatabasePrimary Email AddressOrganizational UnitSync Age (Days)DeviceIDDeviceAccessStateDeviceModelDeviceTypeDeviceFriendlyNameDeviceOSLastSyncAttemptTimeLastSuccessSyncOWA_mobileActive_syncOWAIMAPPOP3
AdministratorDo not show system or discovery mailboxes 200Enabled45 GB 46 GB 100 GB Show only TRUE29-06-2020 11:211.1.1.1 if we can get country or city name then it will be greatMailbox Database 0113842332Administrator@domain.comdomain.com/Users07DP52ON7777CT98SJ39FM7KAllowediPhone10C6iPhoneiPhone XiOS 13.5.1 17F8008-07-2020 12:5908-07-2020 12:59EnabledEnabledEnabledEnabledDisabled

He was helpful and provided me leads so that I may have my desired results by working out further.
I understand everyone has limitation & support upto a certain limit.
 I got a solution from him.
Thanks for the support. 
You are most welcome...