# Active Director Inspector # Brainhub24.com # Get all necessary informations about your AD-Users incl. Email and without as csv output. # + + + + + + + + + + + + + + + + + Example + + + + + + + + + + + + + + + + + + # # Name,EmailAddress # John Doe,john.doe@example.com # Jane Smith,jane.smith@example.com # Alice Johnson,alice.johnson@example.com # Bob Brown, # Charlie Davis, ################################################################################# $users = Get-ADUser -Filter * -Properties EmailAddress # User mit und ohne Email $usersWithEmail = $users | Where-Object { $_.EmailAddress -ne $null } $usersWithoutEmail = $users | Where-Object { $_.EmailAddress -eq $null } # Combine the results $sortedUsers = $usersWithEmail + $usersWithoutEmail # Export als CSV # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.4 $sortedUsers | Select-Object Name, EmailAddress | Export-Csv -Path "C:\ADUsers.csv" -NoTypeInformation