我已經編寫了一個腳本來從Active Directory和Exchange中返回一些詳細信息,然後將這些詳細信息放入數組中。腳本不向新列添加新數據
問題是Exchange部分覆蓋了數組中的現有值,而我希望它基本上爲Exchange數據創建一個新列並將其放在那裏。
這裏的腳本:
$adusers = Get-ADUser -Filter {Enabled -eq $true} -Properties LastLogonDate, createTimeStamp, mail |
Where-Object { $_.Name -like $_."Name" } |
Select Name, SamAccountName, LastLogonDate, createTimeStamp, mail
$adusers | ForEach-Object {
$mailboxstats = Get-Mailbox $_.mail |
Get-MailboxStatistics |
Select-Object TotalItemSize
$adusers += $mailboxstats
}
return $adusers
'Where-Object {$ _。Name-like $ _。「Name」}'你知道這總是對的,對嗎? –