18 lines
747 B
PowerShell
18 lines
747 B
PowerShell
$Info = @()
|
|
$AAD_users = Get-AzureADUser -All:$true
|
|
foreach ($AAD_User in $AAD_users) {
|
|
$objInfo = [PSCustomObject]@{
|
|
Name = $AAD_User.DisplayName
|
|
Email = $AAD_User.mail
|
|
userType = $AAD_User.userType
|
|
jobTitle = $AAD_User.jobTitle
|
|
accountEnabled = $AAD_User.accountEnabled
|
|
Country = $AAD_User.Country
|
|
creationType = $AAD_User.creationType
|
|
UserState = $AAD_User.UserState
|
|
CreationDateTime = (Get-AzureADUserExtension -ObjectId $AAD_User.ObjectId).Get_Item("createdDateTime")
|
|
#signin = (Get-AzureADAuditSignInLogs -Filter userId = $AAD_User.ObjectId and status/errorCode eq 0 | Select CreatedDateTime -First 1)
|
|
}
|
|
$Info += $objInfo
|
|
}
|
|
$Info | Export-csv -Path "c:\temp\AzureADUsers.csv" -NoTypeInformation -Force -Append -Encoding UTF8 |