Skip to content

Instantly share code, notes, and snippets.

@kevinblumenfeld
Created November 6, 2019 16:25
Show Gist options
  • Save kevinblumenfeld/dd418861c94effb26d8f35a135d90b88 to your computer and use it in GitHub Desktop.
Save kevinblumenfeld/dd418861c94effb26d8f35a135d90b88 to your computer and use it in GitHub Desktop.
$AllMailboxes = Import-Clixml -Path (Join-Path ([Environment]::GetFolderPath("Desktop")) AllMailboxes.xml)
$del = for ($i = 0 ; $i -lt $AllMailboxes.Count; $i++) {
[pscustomobject]@{
Count = $i
DisplayName = $AllMailboxes[$i].displayname
PrimarySmtpAddress = $AllMailboxes[$i].PrimarySmtpAddress
OU = $AllMailboxes[$i].OrganizationalUnit
}
}
$del | Export-csv -Path (Join-Path -Path ([Environment]::GetFolderPath("Desktop")) -ChildPath 'NumberedMailboxes.csv') -NoTypeInformation -Encoding UTF8
$del = $null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment