NAF-Data
asked on
Need export a list of users and emailadress within a DB on exchange 2010
We run Exchange 2010 SP1 on Windows 2008 R2 server. We have 3 hub/cas and 3 db servers with exchange 2010. No other exchange servers in our system. The users in the database Im working on is linked to a user acocunts in another domain in another tree.
I need to make a list of all the users in a database with their displayname, alias, primarysmtpaddress and all their other mailaddresses.
I have tried several command without success.
Here is an example of what I have tried:
Get-Mailbox -Database "dbname" | Select-Object alias, displayname, primarysmtpaddress
This command will list all the room mailboxes, and no users! Why will this not list the users?
I also tried what is mentioned in this article: http://unlockpowershell.wordpress.com/2010/01/27/powershell-get-mailbox-display-smtp-addresses/
Still no luck. Does anyone have a good string of command that wil list my users?
I need to make a list of all the users in a database with their displayname, alias, primarysmtpaddress and all their other mailaddresses.
I have tried several command without success.
Here is an example of what I have tried:
Get-Mailbox -Database "dbname" | Select-Object alias, displayname, primarysmtpaddress
This command will list all the room mailboxes, and no users! Why will this not list the users?
I also tried what is mentioned in this article: http://unlockpowershell.wordpress.com/2010/01/27/powershell-get-mailbox-display-smtp-addresses/
Still no luck. Does anyone have a good string of command that wil list my users?
ASKER
Is there really no code within Exchange Management Shell that can export a list of the users with their email address?????
I tried this script you posted, I have installed ActiveRoles Management Shell. But I get these error messages:
[PS] C:\>.\ExchangeReporting.ps 1
Add-PSSnapin : Cannot add Windows PowerShell snap-in Quest.ActiveRoles.ADManage ment because it is already added. Verify
the name of the snap-in and try again.
At C:\ExchangeReporting.ps1:6 char:13
+ Add-PSSnapin <<<< Quest.ActiveRoles.ADManage ment
+ CategoryInfo : InvalidArgument: (Quest.ActiveRoles.ADManag ement:Stri ng) [Add-PSSnapin], PSArgumentExcep
tion
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft. PowerShell .Commands. AddPSSnapi nCommand
The term 'Get-MailboxStatistics' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\ExchangeReporting.ps1:2 2 char:46
+ $colMailboxStatistics = Get-MailboxStatistics <<<<
+ CategoryInfo : ObjectNotFound: (Get-MailboxStatistics:Str ing) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
COMPANY;NAME Firstname;Mail;Size (MB)
Get-QADUser : Cannot validate argument on parameter 'Identity'. The argument is null or empty. Supply an argument that
is not null or empty and then try the command again.
At C:\ExchangeReporting.ps1:2 9 char:34
+ $objUser = Get-QADUser -Identity <<<< $_.LegacyDN
+ CategoryInfo : InvalidData: (:) [Get-QADUser], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nError,Que st.ActiveR oles.ArsPo werShellSn apIn.Power shell.Cmdl et
s.GetUserCmdlet
I tried this script you posted, I have installed ActiveRoles Management Shell. But I get these error messages:
[PS] C:\>.\ExchangeReporting.ps
Add-PSSnapin : Cannot add Windows PowerShell snap-in Quest.ActiveRoles.ADManage
the name of the snap-in and try again.
At C:\ExchangeReporting.ps1:6
+ Add-PSSnapin <<<< Quest.ActiveRoles.ADManage
+ CategoryInfo : InvalidArgument: (Quest.ActiveRoles.ADManag
tion
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.
The term 'Get-MailboxStatistics' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\ExchangeReporting.ps1:2
+ $colMailboxStatistics = Get-MailboxStatistics <<<<
+ CategoryInfo : ObjectNotFound: (Get-MailboxStatistics:Str
+ FullyQualifiedErrorId : CommandNotFoundException
COMPANY;NAME Firstname;Mail;Size (MB)
Get-QADUser : Cannot validate argument on parameter 'Identity'. The argument is null or empty. Supply an argument that
is not null or empty and then try the command again.
At C:\ExchangeReporting.ps1:2
+ $objUser = Get-QADUser -Identity <<<< $_.LegacyDN
+ CategoryInfo : InvalidData: (:) [Get-QADUser], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
s.GetUserCmdlet
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
.
You could use the script below :
1/ save it to a file name ExchangeReporting.ps1
2/ install PowerShell 2.0 on your mailbox server
3/ install ActiveRoles Management Shell for Active Directory from PowerQuest from here :
http://www.quest.com/powershell/activeroles-server.asp
4/ start an Exchange Management Shell and run ./ExchangeReporting.ps1
Open in new window
Hope this helps !
Yoann