SOLVED
Home

Azure AD join device list export

%3CLINGO-SUB%20id%3D%22lingo-sub-290550%22%20slang%3D%22en-US%22%3EAzure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290550%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3ECan%20you%20please%20help%20me%20to%20export%20Azure%20AD%20join%20device%20list%20from%20azure%20portal%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20and%20Regards%2C%3C%2FP%3E%3CP%3EShubham%20Kumar%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-290550%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-332314%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-332314%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20i%20try%20to%20export%20the%20list%20with%20registeredowners%20i%20am%20getting%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3ESystem.Collections.Generic.List%601%5BSystem.String%5D%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3Ein%20the%20output.%20can%20you%20help%20me%20provide%20the%20correct%20expression%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290672%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290672%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Shubham%2C%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20can%20get%20a%20list%20of%20Azure%20AD%20joined%20devices%20through%20the%20Get-MsolDevice%20cmdlet%20in%20Powershell.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fmsonline%2Fget-msoldevice%3Fview%3Dazureadps-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fmsonline%2Fget-msoldevice%3Fview%3Dazureadps-1.0%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20Get-MsolDevice%20-All%20-ReturnRegisteredOwners%20cmdlet%20will%20output%20a%20list%20of%20all%20devices%20and%20their%20owners%20which%20contain%20the%20output%20DeviceTrustType%20which%20is%20the%20device%20trust%20type.%20The%20value%20could%20be%20one%20of%20the%20following%3A%20Workplace%20Joined%2C%20AzureAD%20Joined%2C%20Domain%20Joined.%3CBR%20%2F%3E%3CBR%20%2F%3EAll%20you%20need%20to%20do%20is%20combine%20this%20with%20an%20export%20command%20such%20as%20%7C%20Export-Csv%20C%3A%5CTemp%5CLicensedUsers.csv%20and%20this%20should%20give%20you%20the%20list.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAFAIK%2C%20there%20isn't%20a%20way%20to%20do%20this%20through%20the%20portal%20currently.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%2C%20Chris%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-504342%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-504342%22%20slang%3D%22en-US%22%3E%3CP%3EHas%20there%20been%20any%20more%20answers%20on%20this%3F%26nbsp%3B%20I%20am%20getting%20the%20same%20issue%20when%20running%20the%20commands.%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F78358%22%20target%3D%22_blank%22%3E%40Praneeth%20Rajalingari%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F169605%22%20target%3D%22_blank%22%3E%40Christopher%20Hoard%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-512613%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-512613%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20also%20getting%20System.Collections.Generic.List%601%5BSystem.String%5D%20for%20the%20registered%20owners.%26nbsp%3B%20I've%20tried%20various%20methods%20to%20get%20the%20data%20to%20populate%2C%20however%2C%20since%20the%20username%20is%20behind%20%7B%7D%20it%20never%20seems%20to%20want%20to%20populate%20correctly.%26nbsp%3B%20Is%20the%20output%20an%20array%20of%20some%20sort%2C%20or%20just%20a%20generic%20text%20output%3F%26nbsp%3B%20I%20need%20this%20to%20more%20accurately%20control%20my%20inventory.%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F169605%22%20target%3D%22_blank%22%3E%40Christopher%20Hoard%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-525676%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-525676%22%20slang%3D%22en-US%22%3EHi%20guys%2C%3CBR%20%2F%3E%3CBR%20%2F%3EPersonally%2C%20I%20would%20recommend%20to%20raise%20a%20ticket%20for%20this%20if%20you%20are%20having%20issues%20with%20it.%20I%20have%20never%20experienced%20this%20issue%20so%20can't%20say%20what%20could%20be%20causing%20this.%3CBR%20%2F%3E%3CBR%20%2F%3EBest%2C%20Chris%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-693165%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-693165%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F330572%22%20target%3D%22_blank%22%3E%40jamesOnco360%3C%2FA%3EWondering%20if%20anyone%20has%20resolved%20the%20issue%20with%20returning%20the%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3ESystem.Collections.Generic.List%601%5BSystem.String%5D%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3Bresult%20for%20Registered%20owners%20(instead%20of%20the%20UPN)%20when%20running%20the%20Azure%20AD%20Get-MSolDevice%20script%20and%20exporting%20to%20csv.%26nbsp%3B%20Thanks!%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F169605%22%20target%3D%22_blank%22%3E%40Christopher%20Hoard%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-693169%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-693169%22%20slang%3D%22en-US%22%3E%3CP%3ENot%20to%20my%20knowledge.%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F360585%22%20target%3D%22_blank%22%3E%40LD970%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-803424%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-803424%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F360585%22%20target%3D%22_blank%22%3E%40LD970%3C%2FA%3E%3C%2FP%3E%3CP%3EDoes%20this%20produce%20the%20desired%20result%3F%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EConnect-MsolService%0A%0A%24TStamp%20%3D%20%24(get-date%20-f%20MM-dd-yyyy_HH_mm_ss)%0A%0A%24Devices%20%3D%20Get-MsolDevice%20-All%20-ReturnRegisteredOwners%20-IncludeSystemManagedDevices%0A%24DeviceInfo%20%3D%20%40()%0A%0Aforeach%20(%24Device%20in%20%24Devices)%20%7B%0A%20%20%20%20%24DeviceInfo%20%2B%3D%20%5BPSCustomObject%5D%40%7B%0A%20%20%20%20%20%20%20%20%22DisplayName%22%20%3D%20%24Device.DisplayName%0A%20%20%20%20%20%20%20%20%22DeviceTrustType%22%20%3D%20%24Device.DeviceTrustType%0A%20%20%20%20%20%20%20%20%22DeviceTrustLevel%22%20%3D%20%24Device.DeviceTrustLevel%0A%20%20%20%20%20%20%20%20%22DeviceOS%22%20%3D%20%24Device.DeviceOsType%0A%20%20%20%20%20%20%20%20%22DeviceVersion%22%20%3D%20%24Device.DeviceOsVersion%0A%20%20%20%20%20%20%20%20%22RegisteredOwner%22%20%3D%20%24(%24Device.RegisteredOwners)%0A%20%20%20%20%20%20%20%20%22LastLogon%22%20%3D%20%24Device.ApproximateLastLogonTimestamp%0A%20%20%20%20%20%20%20%20%22LastDirSync%22%20%3D%20%24Device.LastDirSyncTime%0A%20%20%20%20%20%20%20%20%22DeviceID%22%20%3D%20%24Device.DeviceId%0A%20%20%20%20%20%20%20%20%22ObjectID%22%20%3D%20%24Device.ObjectId%0A%20%20%20%20%7D%0A%7D%0A%24DeviceInfo%20%7C%20Export-Csv%20-NoTypeInformation%20.%5C%22Device%20Info%20-%20%24TStamp.csv%22%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-833146%22%20slang%3D%22en-US%22%3ERe%3A%20Azure%20AD%20join%20device%20list%20export%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-833146%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F391851%22%20target%3D%22_blank%22%3E%40kennedy_shane%3C%2FA%3E%26nbsp%3BI%20think%20it%20does%20but%20why%20do%20things%20in%2015%20lines%20when%20you%20could%20do%20it%20in%20one%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Fhappyface_40x40.gif%22%20alt%3D%22%3Ahappyface%3A%22%20title%3D%22%3Ahappyface%3A%22%20%2F%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3EGet-MsolDevice%20-All%20-ReturnRegisteredOwners%20-IncludeSystemManagedDevices%20%7C%20Select-Object%20*%2C%40%7BName%3D'RegisteredOwnersToString'%3BExpression%20%3D%20%7B%24_.RegisteredOwners.Normalize()%7D%7D%20%7C%20Export-Csv%20devices.csv%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Shubham kumar
Occasional Contributor

Hi all,

Can you please help me to export Azure AD join device list from azure portal?

 

 

Thanks and Regards,

Shubham Kumar

 

9 Replies
Solution

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

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?

Has there been any more answers on this?  I am getting the same issue when running the commands. @Praneeth Rajalingari @Christopher Hoard 

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. @Christopher Hoard 

Hi 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

@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! @Christopher Hoard 

Not to my knowledge.@LD970 

@LD970

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"

@kennedy_shane I think it does but why do things in 15 lines when you could do it in one :happyface: 

 

 

Get-MsolDevice -All -ReturnRegisteredOwners -IncludeSystemManagedDevices | Select-Object *,@{Name='RegisteredOwnersToString';Expression = {$_.RegisteredOwners.Normalize()}} | Export-Csv devices.csv

 

Related Conversations