Get-AzureADDevice - Registered devices

Copper Contributor

Getting the error message when I run this command

 

PS C:\Windows\system32> Get-AzureADDevice -all $true | Where-Object{($_.DeviceTrustType -eq"ServerAd") -and ($_.ProfileType -ne"RegisteredDevice") -and (-not $_.AlternativeSecurityIds)} | select-object -Property AccountEnabled, ObjectId, DeviceId, DisplayName, DeviceOSType, DeviceOSVersion, DeviceTrustType | export-csv pendingdevicelist-summary.csv -NoTypeInformation

 

Get-AzureADDevice : The term 'Get-AzureADDevice' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ Get-AzureADDevice -all $true | Where-Object{($_.DeviceTrustType -eq" ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureADDevice:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

1 Reply
Well, do you have the AzureAD PowerShell module installed and are you connected to it via an account with sufficient privileges?
https://learn.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0