Forum Discussion
Get a report of all cloud accounts
If you're using the newer AzureAD module:
Get-AzureADUser | Where {$_.DirSyncEnabled -ne $true}Interestingly, the values appear to be either "True" or "null", not "False.
PS C:\> Get-AzureADUser | Group-Object -Property:DirSyncEnabled
Count Name Group
----- ---- -----
98 True {class User {...
2 {class User {...The trouble I'm having with this command is that it does not return all objects. While the documentation states that there is an -All flag that should achieve this,(https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureaduser?view=azureadps-2.0) it does not appear to work.
Running Get-Help Get-AzureADUser does not show the -All flag.
PS C:\Windows\system32> Get-Help Get-AzureADUser
NAME
Get-AzureADUser
SYNOPSIS
Retrieves a specific user from Azure Active Directory
SYNTAX
Get-AzureADUser [-Top <Nullable`1[Int32]>] [-Filter <String>] [<CommonParameters>]
Get-AzureADUser [-SearchString <String>] [<CommonParameters>]
Get-AzureADUser -ObjectId <String> [<CommonParameters>]
DESCRIPTION
RELATED LINKS
REMARKS
To see the examples, type: "get-help Get-AzureADUser -examples".
For more information, type: "get-help Get-AzureADUser -detailed".
For technical information, type: "get-help Get-AzureADUser -full".
For online help, type: "get-help Get-AzureADUser -online"
- VasilMichevApr 17, 2018MVP
"All" is a Boolean parameter, so you have to use it like this:
Get-AzureADUser -All $true
I know, stupid, just add it to the list of inconveniences for the module...
- David BlodgettApr 17, 2018Copper Contributor
Yes, I read that was the case, but it does not work. This is the result I get from that command.
PS C:\Windows\system32> Get-AzureADUser -All $True
Get-AzureADUser : A parameter cannot be found that matches parameter name 'All'.
At line:1 char:17
+ Get-AzureADUser -All $True
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzureADUser], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Open.AzureAD16.PowerShell.GetUser- VasilMichevApr 17, 2018MVP
What version of the AzureAD module is that?