Andy Andy
asked on
Exchange Mailboxes Detail Export
Hello Team,
Could you please suggest the command to pull the following details in Exhcange 2013 through powershell.
DisplayName.
FirstName
LastName,
Organizational Unit
MailboxType
LastLogontimeStamp
Appreciate, if someone can suggest ASAP
Thanks,
Andy
Could you please suggest the command to pull the following details in Exhcange 2013 through powershell.
DisplayName.
FirstName
LastName,
Organizational Unit
MailboxType
LastLogontimeStamp
Appreciate, if someone can suggest ASAP
Thanks,
Andy
ASKER
can you please provide the Powershell command to get all details
Why don't you find that out yourself? It doesn't help you long-term if we just provide the ready-to-use command. Building the correct statements is always along this:
You check which cmdlets could retrieve the desired information. With Exchange you start with Get-Mailbox whenever mailboxes are concerned.
Then you check what the results are:
You check which cmdlets could retrieve the desired information. With Exchange you start with Get-Mailbox whenever mailboxes are concerned.
Then you check what the results are:
Get-Mailbox OneOfYourMailboxes | fl *
That displays the available info for a single mailbox. Now use the property names as displayed.Get-Mailbox | Select DisplayName. FirstName, LastName, OrganizationalUnit, MailboxType, LastLogontimeStamp
I didn't check if the property names I used are the correct ones, but you should get the idea.
get-mailbox -resultsize unlimited | FL DisplayName, FirstName, LastName, Organizational Unit, MailboxType, LastLogontimeStamp
OR
Get-MailBox | Format-List *
For info refer below link:
http://exchangeserverpro.com/powershell-tip-get-list-top-exchange-server-mailboxes-size/
OR
Get-MailBox | Format-List *
For info refer below link:
http://exchangeserverpro.com/powershell-tip-get-list-top-exchange-server-mailboxes-size/
ASKER
i used the command, but it didnt helped
ok i have feteched all other details.
can only i get Displayname and Lastlogontime for all users
ok i have feteched all other details.
can only i get Displayname and Lastlogontime for all users
So you are just lazy? The explanation I provided should make it easy for you to see the correct property names.
ASKER
But i need for all mailboxes in environment
ASKER
i have used this command
Get-mailbox -resultsize unlimited| Get-MailboxStatistics | select displayname, lastlogontime | Export-Csv C:\test1.csv
but it fetch the report of users who logged on server, not user logontime, when they accessed there mailbox
Get-mailbox -resultsize unlimited| Get-MailboxStatistics | select displayname, lastlogontime | Export-Csv C:\test1.csv
but it fetch the report of users who logged on server, not user logontime, when they accessed there mailbox
Run the below command
Get-mailbox -resultsize unlimited| FL displayname, lastlogontime | Export-Csv C:\test1.csv
Get-mailbox -resultsize unlimited| FL displayname, lastlogontime | Export-Csv C:\test1.csv
ASKER
i think this need to be fetched through get-mailboxstatistics, because that can give the lastlogontime
but i didn't get the details of all 20000 mailboxes in environment
but i didn't get the details of all 20000 mailboxes in environment
ASKER
Qlemo, if i need to searched by own, then what will experts will do ????
i have doubt, that is why i posted question here. because when i tried to use any of above commands.
i got the lastlogontime of user who logged on server. not of user logontime , which state, when user last accessed his mailbox
Hope you get the question properly now.
i have doubt, that is why i posted question here. because when i tried to use any of above commands.
i got the lastlogontime of user who logged on server. not of user logontime , which state, when user last accessed his mailbox
Hope you get the question properly now.
Get-mailbox may not output the FirstName, LastName details..
Try.. Get-Recipient
You can test by Login to a test mailbox to confirm the same..
Try.. Get-Recipient
Get-Recipient -Resultsize unlimited | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails
i got the lastlogontime of user who logged on server. not of user logontime , which state, when user last accessed his mailboxLastLogonTime is fetched from domain controller, it doesn't differentiate whether it's mailbox login or computer login. However if the LastLoggedOnUserAccount is present then we can safely assume the user is logged in to mailbox.
You can test by Login to a test mailbox to confirm the same..
ASKER
cant we get LastLogonTime from exchange powershell ??
Get-MailboxStatistics should show it...
If you need all details as a single command result, then you need to make a custom property
Ref : https://blogs.technet.microsoft.com/josebda/2014/04/19/powershell-tips-for-building-objects-with-custom-properties-and-special-formatting/
Example..
Let us know if you have any questions..
Get-MailboxStatistics User | Select Last*
If you need all details as a single command result, then you need to make a custom property
Ref : https://blogs.technet.microsoft.com/josebda/2014/04/19/powershell-tips-for-building-objects-with-custom-properties-and-special-formatting/
Example..
Get-Recipient -Resultsize unlimited | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={($_| Get-MailboxStatistics).LastLogonTime}}
Let us know if you have any questions..
In my opinion, The details posted by experts have good information to solve your request. If you find a different solution please post it and close this question by accepting your comments.
ASKER
subsan,
In your command, lastlogontime is showing blank.. so i need this as a main thing.
In your command, lastlogontime is showing blank.. so i need this as a main thing.
ASKER
i have exported all required attributes through below command from Powershell
csvde -f EU.csv -s domainname -p subtree -d "dc=domain,dc=ent,dc=domai n,dc=com" -r "(&(objectCategory=person) (objectCla ss=User)(! userAccoun tControl:1 .2.840.113 556.1.4.80 3:=2))" -l "givenName,sn,sAMAccountNa me,display Name,disti nguishedNa me,userAcc ountContro l,lastLogo n,Lastlogo ntimestamp "
csvde -f EU.csv -s domainname -p subtree -d "dc=domain,dc=ent,dc=domai
ASKER
i need exactly same like this, but lastlogontime is empty for all users
i am in exchange 2013 environment and using windows powershell
i am in exchange 2013 environment and using windows powershell
It should work in Exchange 2013, are you using the exact command which I posted?
If yes post the result of following command for one user
If yes post the result of following command for one user
Get-Recipient UserA | Get-MailboxStatistics | FL Last*
ASKER
yes now i got the result of this
LastLoggedOnUserAccount :
LastLogoffTime :
LastLogonTime : 9/13/2016 9:45:22 AM
can you suggest, what was the mistake in old command
LastLoggedOnUserAccount :
LastLogoffTime :
LastLogonTime : 9/13/2016 9:45:22 AM
can you suggest, what was the mistake in old command
I am not sure yet.. Try following commands and see.. if it gives desired result..
Get-Recipient UserA | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={($_| Get-MailboxStatistics).LastLogonTime}}
AndGet-Recipient -Resultsize unlimited | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={($_| Get-MailboxStatistics).LastLogonTime}}
ASKER
now again when i type your first command,
still lastlogontime is blank..
and with second command same result
still lastlogontime is blank..
and with second command same result
That's really strange... Does any of following command give result?
If not post the screenshot of the commands which you run and the result, let me se if I can figure it out what is wrong..
Get-Recipient UserA | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={(Get-MailboxStatistics $_.Alias).LastLogonTime}}
Foreach ($user in (Get-Recipient UserA)){
$St = $user | Get-MailboxStatistics
$User | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={$St.LastLogonTime}}
}
If not post the screenshot of the commands which you run and the result, let me se if I can figure it out what is wrong..
ASKER
yes now , with the first command i got the results, which required
Get-Recipient ngupta2 | Select DisplayName, FirstName, LastName, OrganizationalUnit,Recipie ntTypeDeta ils,@{N="L astLogonTi me";E={(Ge t-MailboxS tatistics $_.Alias).LastLogonTime}}
can we make it for all mailboxes in environment and export in CSV file
Get-Recipient ngupta2 | Select DisplayName, FirstName, LastName, OrganizationalUnit,Recipie
can we make it for all mailboxes in environment and export in CSV file
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or try..
$(Foreach ($user in (Get-Recipient -Resultsize unlimited | ?{$_.RecipientTypeDetails -eq "UserMailbox"})){
$user | Select DisplayName, FirstName, LastName, OrganizationalUnit,RecipientTypeDetails,@{N="LastLogonTime";E={(Get-MailboxStatistics $_.Alias).LastLogonTime}}
})| Export-csv C:\Temp\report.csv -nti
ASKER
this not ggenerates the .csv file it stuck on powershell
what -NTI means in last
what -NTI means in last
ASKER
lovely it worked
As written the file will be generated only after the complete pipeline including the for loop has been processed and finished. Better:
Get-Recipient -Resultsize unlimited |
? { $_.RecipientTypeDetails -eq "UserMailbox" } |
Select DisplayName, FirstName, LastName, OrganizationalUnit, RecipientTypeDetails,
@{N="LastLogonTime";E={(Get-MailboxStatistics $_.Alias).LastLogonTime}} |
Export-csv C:\Temp\report.csv -NoType
-NTI or -NoType are short for -NoTypeInformation. Without the CSV export contains a first line with the data types of each column, and that is usually unwanted, because AFAIK only PowerShell can make use of that type info on import.
FYI.. Direct pipeline sometime wont work well with Exchange Management Shell, I have seen issues like values from result are missing or it may throw errors like 'Pipeline not executed because a pipeline is already executing'. It seems to be a bug, I have seen it from Exchange 2007 onwards.. Work around is to use ForEach (ForEach (item In collection) {ScriptBlock})
The "pipeline" error results from remote shell not being able to use a pipe in a pipe. One level of pipe works well for me. So the trick is rather to use a foreach statement inside the pipeline, and no pipeline inside of the outer loop.
@Qlemo, Right it's related to PowerShell remoting. But the it's weird that the error is kind of random, same code which gives error may work if you run it for second or third time. In this question the code which I gave initially works well in my Exchange 2013 server but it doesn't worked for Andy Navi.. :-)
Following code fails randomly even if i runs it locally on exchange server..
@Andy Navi, Your comment ID: 41795545 is not a PowerShell answer. So if you are OK, you can choose the PowerShell answer which worked for you!
Following code fails randomly even if i runs it locally on exchange server..
Get-Mailbox -OrganizationalUnit Admin | %{ New-InboxRule -Name Attach -Mailbox $_ -HasAttachment $true -MarkImportance High }
Following code always work..$sales = Get-Mailbox -OrganizationalUnit Admin
$sales | %{New-InboxRule -Name Attach -Mailbox $_ -HasAttachment $true -MarkImportance High}
I will try your suggestion..@Andy Navi, Your comment ID: 41795545 is not a PowerShell answer. So if you are OK, you can choose the PowerShell answer which worked for you!
Luckily I did not encouter such issues yet ;-).
ASKER
this question is already closed. thanks for helping me
i really appreciate
i really appreciate
It can be cancelled. You can choose the powershell answer or multiple comments as answer + assisted comments.
ASKER
Thank you very much
https://www.manageengine.com/products/ad-manager/active_directory_exchange_server_reports.html?cam=31691748&adgid=2970337477&kwd=%2Bexchange%20%2Bserver%20%2Btool&loc=&utm_source=bing&utm_medium=cpc&utm_campaign=ADMP%20Search%20Core%20%2B%2B&utm_term=%2Bexchange%20%2Bserver%20%2Btool&utm_content=Exchange%20Server%20Reports
OR
If you want to do get information through power shell then refer below link :
http://exchangeserverpro.com/powershell-tip-get-list-top-exchange-server-mailboxes-size/
http://exchangeserverpro.com/powershell-script-create-mailbox-size-report-exchange-server-2010/
https://www.petri.com/getting-mailbox-sizes-in-powershell