RoboMunch
asked on
Piping multiple cmdlets into a single CSV file?
I need to get some information from three different cmdlets and I'm having some trouble. I'm trying to pull it from these:
Get-User (FirstName & LastName)
Get-Mailbox (SamAccountName)
Get-MailboxStatistics (ItemCount & TotalItemSize)
Is there a way to get all of thes into a single .csv file?
Thanks in advance for the help!
Get-User (FirstName & LastName)
Get-Mailbox (SamAccountName)
Get-MailboxStatistics (ItemCount & TotalItemSize)
Is there a way to get all of thes into a single .csv file?
Thanks in advance for the help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or you could just switch the first row in the first response to whatever you like.
$Users = Get-Mailbox -ResultSize unlimited | where {$_.RecipientTypeDetails -eq "UserMailbox"} | Get-User
Will return only users with user mailboxes for instance.
ASKER
Thanks for the replies!
There are about 15,000 mailboxes in this environment, so I was hoping to break it down by server (there are 4) or even database. I'm assuming this would work, correct?
There are about 15,000 mailboxes in this environment, so I was hoping to break it down by server (there are 4) or even database. I'm assuming this would work, correct?
$Users = Get-Mailbox -Server XXXXXXX...
or$Users = Get-Mailbox -Database XXXXXXX...
Yep. Alternatively when getting all mailboxes the Get-Mailbox command should contain the DB's/Server names so you can just include those fields in your report.
I think stefor's solution is better as it uses the arrays properly as opposed to the other one you were given.
Though I don't know why he bothered to filter the $output results with the Select statement, just put whatever you want into the array and then just pipe that to Export-Csv.
I think stefor's solution is better as it uses the arrays properly as opposed to the other one you were given.
Though I don't know why he bothered to filter the $output results with the Select statement, just put whatever you want into the array and then just pipe that to Export-Csv.
ASKER
Awesome script, worked perfectly...thanks!
The following will return the details only for users with mailbox.
Open in new window