J'essaie d'obtenir un rapport Exchange 2010 à partir d'une plate-forme mutualisée. La chose est que j'ai besoin d'informations obtenues à partir de différentes applets de commande. Notre client demande pour DisplayName, MailboxPlan, PrimarySMTPAddress(Get-Mailbox), TotalItemSize et lastlogontime (Get-MailboxStatistics)Besoin d'obtenir un rapport utilisateur Exchange 2010
Je suis en train de le faire en utilisant Powershell, mais Je reçois une erreur ... pouvez-vous m'aider à trouver ce qui ne va pas?
est ici le script:
$TBMailbox = Get-Mailbox -Organization organization -ResultSize Unlimited | Select-Object Identity,DisplayName,MailboxPlan,PrimarySMTPAddress
ForEach ($Mbx in $TBMailbox) {$temp += ,(Get-MailboxStatistics -Identity $Mbx.Identity | Select $Mbx.Identity,$Mbx.DisplayName,$Mbx.MailboxPlan,$Mbx.PrimarySMTPAddress,TotalItemSize,LastLogonTime)}
$temp | Export-Csv -Path "C:\Path"
J'obtiens cette erreur:
- ForEach ($Mbx in $TBMailbox) {$temp += ,(Get-MailboxStatistics -Identity $Mbx.Identity | Select <<<< $Mbx.Identity,$Mbx.MailboxPlan,$Mbx.PrimarySMTPAddress,TotalItemSize,LastLogonTime)}
- CategoryInfo : InvalidArgument: (:) [Select-Object], NotSupportedException
- FullyQualifiedErrorId : DictionaryKeyUnknownType,Microsoft.PowerShell.Commands.SelectObjectCommand Select-Object : Cannot convert Microsoft.Exchange.Data.Directory.ADObjectId to one of the following types {System.String, System. Management.Automation.ScriptBlock}. At line:1 char:96
Toute pensée?
Mise à jour
Essayé une approche différente, mais avec le même résultat. Je pense que le problème est ici Select-Object:
Get-Mailbox -Organization organization -ResultSize Unlimited | ForEach-Object -Process {Select-Object $_.DisplayName,$_.MailboxPlan,$_.PrimarySMTPAddress,@{n=”Size(MB)”;e = {$MBXstat = Get-MailboxStatistics -Identity $_.Identity; $MBXstat.totalItemsize.value.toMB()}},@{n="LastLogonTime";e = {$MBXstat = Get-MailboxStatistics -Identity $_.Identity; $MBXstat.lastlogontime}}} | Export-Csv "C:\report.csv"
** Mise à jour **: J'ai essayé d'utiliser '' select' et Select-Object -Property', et il échoue avec la même erreur message – EdoBarroso