{"id":9523,"date":"2026-04-01T02:09:14","date_gmt":"2026-04-01T02:09:14","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=9523"},"modified":"2026-04-01T02:09:15","modified_gmt":"2026-04-01T02:09:15","slug":"script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune","title":{"rendered":"Script to get list of Machines not enrolled into Defender but enrolled into Intune"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"\">&lt;#\n.SYNOPSIS\n    Gets all Intune enrolled devices not onboarded into Microsoft Defender for Endpoint.\n    Matches directly on azureADDeviceId (Intune) = aadDeviceId (Defender).\n\n.REQUIREMENTS\n    Install-Module Microsoft.Graph -Scope CurrentUser\n#>\n\n# ?? Configuration ??????????????????????????????????????????????????????????????\n$ExportCSV  = $true\n$ExportPath = \".\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv\"\n\n# ?? Login ??????????????????????????????????????????????????????????????????????\nWrite-Host \"Opening browser for login...\" -ForegroundColor Cyan\n\nConnect-MgGraph -Scopes @(\n    \"DeviceManagementManagedDevices.Read.All\",\n    \"SecurityEvents.Read.All\",\n    \"ThreatHunting.Read.All\"\n) -NoWelcome\n\nWrite-Host \"  Logged in as: $((Get-MgContext).Account)\" -ForegroundColor Green\n\n# ?? Step 1: Get all Defender machines via Advanced Hunting ?????????????????????\n# Uses the DeviceInfo table which contains AadDeviceId for all onboarded machines\nWrite-Host \"`nFetching Defender onboarded devices via Advanced Hunting...\" -ForegroundColor Cyan\n\n$mdeLookup = @{}\n\n$huntingBody = @{\n    Query = @\"\nDeviceInfo\n| where isnotempty(AadDeviceId)\n| summarize arg_max(Timestamp, *) by AadDeviceId\n| project AadDeviceId, DeviceName\n\"@\n} | ConvertTo-Json\n\ntry {\n    $huntingResponse = Invoke-MgGraphRequest `\n        -Uri \"https:\/\/graph.microsoft.com\/v1.0\/security\/runHuntingQuery\" `\n        -Method POST `\n        -Body $huntingBody `\n        -ContentType \"application\/json\" `\n        -ErrorAction Stop\n\n    foreach ($row in $huntingResponse.results) {\n        if ($row.AadDeviceId) {\n            $mdeLookup[$row.AadDeviceId.ToLower()] = $row.DeviceName\n        }\n    }\n    Write-Host \"  Found $($mdeLookup.Count) Defender onboarded devices\" -ForegroundColor Green\n}\ncatch {\n    # Fallback: try beta listMachines endpoint\n    Write-Host \"  Hunting query failed, trying beta machines endpoint...\" -ForegroundColor Yellow\n\n    $uri = \"https:\/\/graph.microsoft.com\/beta\/security\/microsoft.graph.security.listMachines()?`$select=aadDeviceId,computerDnsName&amp;`$top=999\"\n    do {\n        $response = Invoke-MgGraphRequest -Uri $uri -Method GET -ErrorAction Stop\n        foreach ($m in $response.value) {\n            if ($m.aadDeviceId) {\n                $mdeLookup[$m.aadDeviceId.ToLower()] = $m.computerDnsName\n            }\n        }\n        $uri = $response.'@odata.nextLink'\n    } while ($uri)\n\n    Write-Host \"  Found $($mdeLookup.Count) Defender onboarded devices\" -ForegroundColor Green\n}\n\nif ($mdeLookup.Count -eq 0) {\n    Write-Error \"Could not retrieve any Defender devices. Check that SecurityEvents.Read.All or ThreatHunting.Read.All is consented in your tenant.\"\n    Disconnect-MgGraph\n    exit 1\n}\n\n# ?? Step 2: Get all Intune managed devices ?????????????????????????????????????\nWrite-Host \"Fetching Intune enrolled devices...\" -ForegroundColor Cyan\n\n$intuneDevices = [System.Collections.Generic.List[object]]::new()\n$uri = \"https:\/\/graph.microsoft.com\/v1.0\/deviceManagement\/managedDevices?\" +\n       \"`$select=id,deviceName,operatingSystem,osVersion,userPrincipalName,\" +\n       \"serialNumber,azureADDeviceId,lastSyncDateTime,complianceState,managedDeviceOwnerType&amp;`$top=999\"\n\ndo {\n    $response = Invoke-MgGraphRequest -Uri $uri -Method GET\n    $intuneDevices.AddRange($response.value)\n    $uri = $response.'@odata.nextLink'\n} while ($uri)\n\nWrite-Host \"  Found $($intuneDevices.Count) Intune devices\" -ForegroundColor Green\n\n# ?? Step 3: Compare directly ???????????????????????????????????????????????????\n# Intune.azureADDeviceId == Defender.AadDeviceId \u2014 direct match, no translation\nWrite-Host \"`nComparing...\" -ForegroundColor Cyan\n\n$results = foreach ($device in $intuneDevices) {\n    $inDefender = $device.azureADDeviceId -and\n                  $mdeLookup.ContainsKey($device.azureADDeviceId.ToLower())\n\n    if (-not $inDefender) {\n        [PSCustomObject]@{\n            DeviceName        = $device.deviceName\n            OS                = $device.operatingSystem\n            OSVersion         = $device.osVersion\n            UserPrincipalName = $device.userPrincipalName\n            SerialNumber      = $device.serialNumber\n            IntuneDeviceId    = $device.id\n            AzureADDeviceId   = $device.azureADDeviceId\n            LastSync          = $device.lastSyncDateTime\n            ComplianceState   = $device.complianceState\n            OwnerType         = $device.managedDeviceOwnerType\n        }\n    }\n}\n\n# ?? Output ?????????????????????????????????????????????????????????????????????\nWrite-Host \"`n???????????????????????????????????????????????????\" -ForegroundColor Yellow\nWrite-Host \"  Total Intune devices:           $($intuneDevices.Count)\" -ForegroundColor White\nWrite-Host \"  Defender onboarded:             $($mdeLookup.Count)\"     -ForegroundColor White\nWrite-Host \"  In Intune but NOT in Defender:  $($results.Count)\"       -ForegroundColor Red\nWrite-Host \"???????????????????????????????????????????????????\" -ForegroundColor Yellow\n\n$results | Format-Table DeviceName, OS, UserPrincipalName, AzureADDeviceId -AutoSize\n\nif ($ExportCSV -and $results.Count -gt 0) {\n    $results | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8\n    Write-Host \"`nExported to: $ExportPath\" -ForegroundColor Green\n}\n\nWrite-Host \"`nBreakdown by OS:\" -ForegroundColor Cyan\n$results | Group-Object OS | Sort-Object Count -Descending | Format-Table Name, Count -AutoSize\n\nDisconnect-MgGraph<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9523","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = &quot;.\\IntuneNotInDefender_$(Get-Date -Format &#039;yyyyMMdd_HHmmss&#039;).csv&quot; # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host &quot;Opening browser for login...&quot; -ForegroundColor Cyan Connect-MgGraph -Scopes @( &quot;DeviceManagementManagedDevices.Read.All&quot;,\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"paris\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Welcome to Pariswells.com |\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com\" \/>\n\t\t<meta property=\"og:description\" content=\"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = &quot;.\\IntuneNotInDefender_$(Get-Date -Format &#039;yyyyMMdd_HHmmss&#039;).csv&quot; # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host &quot;Opening browser for login...&quot; -ForegroundColor Cyan Connect-MgGraph -Scopes @( &quot;DeviceManagementManagedDevices.Read.All&quot;,\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-04-01T02:09:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-04-01T02:09:15+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com\" \/>\n\t\t<meta name=\"twitter:description\" content=\"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = &quot;.\\IntuneNotInDefender_$(Get-Date -Format &#039;yyyyMMdd_HHmmss&#039;).csv&quot; # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host &quot;Opening browser for login...&quot; -ForegroundColor Cyan Connect-MgGraph -Scopes @( &quot;DeviceManagementManagedDevices.Read.All&quot;,\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#article\",\"name\":\"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com\",\"headline\":\"Script to get list of Machines not enrolled into Defender but enrolled into Intune\",\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"},\"datePublished\":\"2026-04-01T02:09:14+00:00\",\"dateModified\":\"2026-04-01T02:09:15+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage\"},\"articleSection\":\"Research\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"name\":\"Research\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"position\":2,\"name\":\"Research\",\"item\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#listItem\",\"name\":\"Script to get list of Machines not enrolled into Defender but enrolled into Intune\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#listItem\",\"position\":3,\"name\":\"Script to get list of Machines not enrolled into Defender but enrolled into Intune\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/category\\\/research#listItem\",\"name\":\"Research\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\",\"name\":\"Welcome to Pariswells.com\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris\",\"name\":\"paris\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"paris\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune\",\"name\":\"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com\",\"description\":\"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = \\\".\\\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv\\\" # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host \\\"Opening browser for login...\\\" -ForegroundColor Cyan Connect-MgGraph -Scopes @( \\\"DeviceManagementManagedDevices.Read.All\\\",\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/research\\\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/author\\\/paris#author\"},\"datePublished\":\"2026-04-01T02:09:14+00:00\",\"dateModified\":\"2026-04-01T02:09:15+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/\",\"name\":\"Welcome to Pariswells.com\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/pariswells.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com","description":"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = \".\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv\" # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host \"Opening browser for login...\" -ForegroundColor Cyan Connect-MgGraph -Scopes @( \"DeviceManagementManagedDevices.Read.All\",","canonical_url":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#article","name":"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com","headline":"Script to get list of Machines not enrolled into Defender but enrolled into Intune","author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"},"datePublished":"2026-04-01T02:09:14+00:00","dateModified":"2026-04-01T02:09:15+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage"},"isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage"},"articleSection":"Research"},{"@type":"BreadcrumbList","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/pariswells.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","name":"Research"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","position":2,"name":"Research","item":"https:\/\/pariswells.com\/blog\/category\/research","nextItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#listItem","name":"Script to get list of Machines not enrolled into Defender but enrolled into Intune"},"previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#listItem","position":3,"name":"Script to get list of Machines not enrolled into Defender but enrolled into Intune","previousItem":{"@type":"ListItem","@id":"https:\/\/pariswells.com\/blog\/category\/research#listItem","name":"Research"}}]},{"@type":"Organization","@id":"https:\/\/pariswells.com\/blog\/#organization","name":"Welcome to Pariswells.com","url":"https:\/\/pariswells.com\/blog\/"},{"@type":"Person","@id":"https:\/\/pariswells.com\/blog\/author\/paris#author","url":"https:\/\/pariswells.com\/blog\/author\/paris","name":"paris","image":{"@type":"ImageObject","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93b8ee3f592ac401167f870452bd82d43de80152cd3524e2853403658ada9984?s=96&d=mm&r=g","width":96,"height":96,"caption":"paris"}},{"@type":"WebPage","@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#webpage","url":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune","name":"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com","description":"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = \".\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv\" # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host \"Opening browser for login...\" -ForegroundColor Cyan Connect-MgGraph -Scopes @( \"DeviceManagementManagedDevices.Read.All\",","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/pariswells.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune#breadcrumblist"},"author":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"creator":{"@id":"https:\/\/pariswells.com\/blog\/author\/paris#author"},"datePublished":"2026-04-01T02:09:14+00:00","dateModified":"2026-04-01T02:09:15+00:00"},{"@type":"WebSite","@id":"https:\/\/pariswells.com\/blog\/#website","url":"https:\/\/pariswells.com\/blog\/","name":"Welcome to Pariswells.com","inLanguage":"en-US","publisher":{"@id":"https:\/\/pariswells.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Welcome to Pariswells.com |","og:type":"article","og:title":"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com","og:description":"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = &quot;.\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv&quot; # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host &quot;Opening browser for login...&quot; -ForegroundColor Cyan Connect-MgGraph -Scopes @( &quot;DeviceManagementManagedDevices.Read.All&quot;,","og:url":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune","article:published_time":"2026-04-01T02:09:14+00:00","article:modified_time":"2026-04-01T02:09:15+00:00","twitter:card":"summary","twitter:title":"Script to get list of Machines not enrolled into Defender but enrolled into Intune | Welcome to Pariswells.com","twitter:description":"# ?? Configuration ?????????????????????????????????????????????????????????????? $ExportCSV = $true $ExportPath = &quot;.\\IntuneNotInDefender_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv&quot; # ?? Login ?????????????????????????????????????????????????????????????????????? Write-Host &quot;Opening browser for login...&quot; -ForegroundColor Cyan Connect-MgGraph -Scopes @( &quot;DeviceManagementManagedDevices.Read.All&quot;,"},"aioseo_meta_data":{"post_id":"9523","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-04-01 02:08:48","updated":"2026-04-01 02:09:15","primary_term":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/pariswells.com\/blog\/category\/research\" title=\"Research\">Research<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tScript to get list of Machines not enrolled into Defender but enrolled into Intune\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/pariswells.com\/blog"},{"label":"Research","link":"https:\/\/pariswells.com\/blog\/category\/research"},{"label":"Script to get list of Machines not enrolled into Defender but enrolled into Intune","link":"https:\/\/pariswells.com\/blog\/research\/script-to-get-list-of-machines-not-enrolled-into-defender-but-enrolled-into-intune"}],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=9523"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9523\/revisions"}],"predecessor-version":[{"id":9524,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/9523\/revisions\/9524"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=9523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=9523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=9523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}