Forum Discussion
Azure AD join device list export
- Nov 23, 2018
Hi Shubham,
You can get a list of Azure AD joined devices through the Get-MsolDevice cmdlet in Powershell.
https://docs.microsoft.com/en-us/powershell/module/msonline/get-msoldevice?view=azureadps-1.0
The Get-MsolDevice -All -ReturnRegisteredOwners cmdlet will output a list of all devices and their owners which contain the output DeviceTrustType which is the device trust type. The value could be one of the following: Workplace Joined, AzureAD Joined, Domain Joined.
All you need to do is combine this with an export command such as | Export-Csv C:\Temp\LicensedUsers.csv and this should give you the list.AFAIK, there isn't a way to do this through the portal currently.
Best, Chris
Hi Shubham,
You can get a list of Azure AD joined devices through the Get-MsolDevice cmdlet in Powershell.
https://docs.microsoft.com/en-us/powershell/module/msonline/get-msoldevice?view=azureadps-1.0
The Get-MsolDevice -All -ReturnRegisteredOwners cmdlet will output a list of all devices and their owners which contain the output DeviceTrustType which is the device trust type. The value could be one of the following: Workplace Joined, AzureAD Joined, Domain Joined.
All you need to do is combine this with an export command such as | Export-Csv C:\Temp\LicensedUsers.csv and this should give you the list.
AFAIK, there isn't a way to do this through the portal currently.
Best, Chris
- Helge56Oct 25, 2019Copper Contributor
ChrisHoardMVPVery easy, very nice, thanks for the short Oneliner..
But how to make, if i have to read more than thousand devices?
- jamesOnco360May 02, 2019Copper Contributor
I am also getting System.Collections.Generic.List`1[System.String] for the registered owners. I've tried various methods to get the data to populate, however, since the username is behind {} it never seems to want to populate correctly. Is the output an array of some sort, or just a generic text output? I need this to more accurately control my inventory. ChrisHoardMVP
- LD970Jun 14, 2019Copper Contributor
jamesOnco360Wondering if anyone has resolved the issue with returning the
System.Collections.Generic.List`1[System.String] result for Registered owners (instead of the UPN) when running the Azure AD Get-MSolDevice script and exporting to csv. Thanks! ChrisHoardMVP
- kennedy_shaneAug 13, 2019Copper Contributor
Does this produce the desired result?
Connect-MsolService $TStamp = $(get-date -f MM-dd-yyyy_HH_mm_ss) $Devices = Get-MsolDevice -All -ReturnRegisteredOwners -IncludeSystemManagedDevices $DeviceInfo = @() foreach ($Device in $Devices) { $DeviceInfo += [PSCustomObject]@{ "DisplayName" = $Device.DisplayName "DeviceTrustType" = $Device.DeviceTrustType "DeviceTrustLevel" = $Device.DeviceTrustLevel "DeviceOS" = $Device.DeviceOsType "DeviceVersion" = $Device.DeviceOsVersion "RegisteredOwner" = $($Device.RegisteredOwners) "LastLogon" = $Device.ApproximateLastLogonTimestamp "LastDirSync" = $Device.LastDirSyncTime "DeviceID" = $Device.DeviceId "ObjectID" = $Device.ObjectId } } $DeviceInfo | Export-Csv -NoTypeInformation .\"Device Info - $TStamp.csv"
- May 03, 2019Hi guys,
Personally, I would recommend to raise a ticket for this if you are having issues with it. I have never experienced this issue so can't say what could be causing this.
Best, Chris
- Praneeth RajalingariFeb 07, 2019Copper Contributor
When i try to export the list with registeredowners i am getting
System.Collections.Generic.List`1[System.String] in the output. can you help me provide the correct expression?
- jamesOnco360Apr 30, 2019Copper Contributor
Has there been any more answers on this? I am getting the same issue when running the commands. Praneeth Rajalingari ChrisHoardMVP