-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathAzureAD_view_Accounts.ps1
40 lines (26 loc) · 1.17 KB
/
AzureAD_view_Accounts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Set-Location c:\
Clear-Host
Install-Module -Name AzureAD -AllowClobber -Force -Verbose
Import-Module AzureAD
#Username and PW for Login
$Credential = Get-Credential
Connect-AzureAD -Credential $Credential
#View all accounts
Get-AzureADUser
#View a specific account
Get-AzureADUser -ObjectID jane.ford@tomwechsler.xyz
#View additional property values for a specific account
Get-AzureADUser | Get-Member
Get-AzureADUser | Select DisplayName,Department,UsageLocation
#To see all the properties for a specific user account
Get-AzureADUser -ObjectID jane.ford@tomwechsler.xyz | Select *
#As another example, check the enabled status of a specific user account
Get-AzureADUser -ObjectID jane.ford@tomwechsler.xyz | Select DisplayName,UserPrincipalName,AccountEnabled
#View account synchronization status
Get-AzureADUser | Where {$_.DirSyncEnabled -eq $true}
#You can use it to find cloud-only accounts
Get-AzureADUser | Where {$_.DirSyncEnabled -ne $false}
#View accounts based on a common property
Get-AzureADUser | Where {$_.UsageLocation -eq $Null}
#List all accounts of users who live in London
Get-AzureADUser | Where {$_.City -eq "Oberbuchsiten"}