{"id":4606,"date":"2023-02-02T10:40:56","date_gmt":"2023-02-02T18:40:56","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4606"},"modified":"2023-02-02T10:42:50","modified_gmt":"2023-02-02T18:42:50","slug":"how-to-export-azure-ad-all-devices","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4606","title":{"rendered":"How to Export Azure AD All Devices"},"content":{"rendered":"\n<p><strong>Step 1, install AzureAD module if you have done this yet.<\/strong><\/p>\n\n\n\n<p>Type \u201cPowerShell\u201d from the start menu &gt;&gt; Right-click on Windows PowerShell and choose \u201cRun as administrator\u201d<br>Type \u201c<strong>Install-Module AzureAD<\/strong>\u201d and hit Enter.<br>You\u2019ll be asked to confirm the installation from the PSGallery. Type \u201cA\u201d to select \u201cYes to All\u201d and hit the Enter key.<\/p>\n\n\n\n<p>To update the existing Azure AD module to the latest version, run the following command as admin:<\/p>\n\n\n\n<p><strong>Update-Module -Name AzureAD<\/strong><\/p>\n\n\n\n<p><strong>Step 2: to run this script, you will need to install the MSOnline module as well.<\/strong><\/p>\n\n\n\n<p>For some backward compatibility, If you need the V1 of the Azure AD PowerShell module (AKA: MSOnline), here is how to install and connect to Microsoft Azure Active Directory with the Connect-MSOLService cmdlet:<\/p>\n\n\n\n<p><strong>Install-Module -Name MSOnline<\/strong><\/p>\n\n\n\n<p>Step 3: Run the below script.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-a35db61e-5cb0-41d6-98ce-5fa90832ad07\" href=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2023\/02\/Azure_Device_List.txt\">Azure_Device_List<\/a><a href=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2023\/02\/Azure_Device_List.txt\" class=\"wp-block-file__button\" download aria-describedby=\"wp-block-file--media-a35db61e-5cb0-41d6-98ce-5fa90832ad07\">Download<\/a><\/div>\n\n\n\n<p>You can download this text file and change its file type to PS1. Or copy the below scripts to make your own piece.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-MsolService\n\n$TStamp = $(get-date -f MM-dd-yyyy_HH_mm_ss)\n\n$Devices = Get-MsolDevice -All -ReturnRegisteredOwners -IncludeSystemManagedDevices\n$DeviceInfo = @()\n\nforeach ($Device in $Devices) {\n    $DeviceInfo += &#91;PSCustomObject]@{\n        \"DisplayName\" = $Device.DisplayName\n        \"DeviceTrustType\" = $Device.DeviceTrustType\n        \"DeviceTrustLevel\" = $Device.DeviceTrustLevel\n        \"DeviceOS\" = $Device.DeviceOsType\n        \"DeviceVersion\" = $Device.DeviceOsVersion\n        \"RegisteredOwner\" = $($Device.RegisteredOwners)\n        \"LastLogon\" = $Device.ApproximateLastLogonTimestamp\n        \"LastDirSync\" = $Device.LastDirSyncTime\n        \"DeviceID\" = $Device.DeviceId\n        \"ObjectID\" = $Device.ObjectId\n    }\n}\n$DeviceInfo | Export-Csv -NoTypeInformation .\\\"Device Info - $TStamp.csv\"<\/code><\/pre>\n\n\n\n<p>Ref: https:\/\/techcommunity.microsoft.com\/t5\/microsoft-defender-for-cloud\/azure-ad-join-device-list-export\/m-p\/290550<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step 1, install AzureAD module if you have done this yet. Type \u201cPowerShell\u201d from the start menu &gt;&gt; Right-click on Windows PowerShell and choose \u201cRun as administrator\u201dType \u201cInstall-Module AzureAD\u201d and hit Enter.You\u2019ll be asked to confirm the installation from the PSGallery. Type \u201cA\u201d to select \u201cYes to All\u201d and hit the Enter key. To update <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4606\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1249,10,1224],"tags":[1487,1488,1489],"class_list":["post-4606","post","type-post","status-publish","format-standard","hentry","category-azure-microsoft","category-microsoft","category-powershell","tag-azure-ad-join-device-list-export","tag-export-azure-ad-all-devices","tag-export-devices-azure"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4606","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4606"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4606\/revisions"}],"predecessor-version":[{"id":4610,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4606\/revisions\/4610"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}