Created
February 27, 2019 19:13
-
-
Save jeremytbrun/e08f7e52ae5a5a15035017ac1f210a56 to your computer and use it in GitHub Desktop.
Get-MailboxShowNulls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$empid = import-csv c:\Temp\Emp_ID_Import.csv | |
$empid | ForEach-Object { | |
$PSObj = New-Object PSObject -Property @{ | |
SamAccountName_Input = $_.SamAccountName | |
} | |
$Mbx = Get-Mailbox -Identity $_.SamAccountName -ErrorAction SilentlyContinue | |
if ($Mbx) { | |
$PropHash = @{} | |
$Mbx.PSObject.Properties | ForEach-Object {$PropHash[$_.Name] = $_.Value} | |
$PSObj | Add-Member -NotePropertyMembers $PropHash | |
} | |
Write-Output $PSObj | |
} | Select SamAccountName_Input, Name, Alias, UserP* | Export-Csv C:\PSExport\MailEXP.csv -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment