Lese-Skript (nur lesen)
Das Skript liest mit Ihrem eigenen Administratorkonto nur Zählwerte aus Microsoft Entra (bedingter Zugriff, MFA-Registrierung), Intune, Exchange Online (Überwachungsprotokoll) und Microsoft Purview, ausschließlich mit Get-Befehlen, und schreibt eine Datei evidence-desk-v1.json. Keine Namen, IDs, Richtliniennamen oder Geräte; keine Änderungen, keine App-Registrierung, nichts wird an uns gesendet.
Skript herunterladen Anleitung
<#
Evidence Desk - Lese-Skript (nur lesen, keine Aenderungen)
Luna group L.L.C-FZ, Dubai - https://nachweis.lunafzai.com
Version 1.0 (26.11.2026)
Was es tut: Liest mit Ihrem eigenen Administratorkonto ZAEHLWERTE aus Microsoft Entra, Intune, Exchange Online
und Microsoft Purview (nur Get-Befehle) und schreibt EINE Datei "evidence-desk-v1.json".
Was es NICHT tut: keine Aenderungen, keine App-Registrierung, nichts wird an uns gesendet. Die Datei enthaelt nur
Zahlen und Ja/Nein-Werte: keine Namen, IDs, Richtliniennamen, Geraete, E-Mail-Adressen oder Fehlertexte.
Quellen einzeln waehlbar: -CA -MFA -Intune -Audit -Purview (ohne Schalter: alle). Pro Quelle Status
ok / not_run / denied / unavailable / error. Fehlende Werte sind null, nicht 0.
Voraussetzungen: PowerShell 7; Module Microsoft.Graph (Authentication, Identity.SignIns, Reports, DeviceManagement)
und fuer Audit/Purview ExchangeOnlineManagement. Rollen z. B. Globaler Leser, Sicherheitsleser,
Compliance-Administrator (nur fuer Purview-Lesezugriffe).
Aufruf: .\evidence-desk.ps1 (alle Quellen)
.\evidence-desk.ps1 -CA -MFA (nur ausgewaehlte)
#>
param([switch]$CA, [switch]$MFA, [switch]$Intune, [switch]$Audit, [switch]$Purview, [string]$Ausgabe = ".\evidence-desk-v1.json")
$ErrorActionPreference = "Stop"
if (-not ($CA -or $MFA -or $Intune -or $Audit -or $Purview)) { $CA = $MFA = $Intune = $Audit = $Purview = $true }
$jetzt = { (Get-Date).ToUniversalTime().ToString("o") }
$R = [ordered]@{ format = "luna-evidence-desk"; schemaVersion = 1; collectedAtUtc = (& $jetzt); sources = [ordered]@{}
conditionalAccess = $null; mfaRegistration = $null; intune = $null; audit = $null; purview = $null }
foreach ($q in "conditionalAccess","mfaRegistration","intunePolicies","intuneDevices","audit","purviewRetention","purviewLabels","purviewLabelPolicies") { $R.sources[$q] = [ordered]@{ status = "not_run"; atUtc = $null } }
function Status($e) { $m = "$($e.Exception.Message)"; if ($m -match "Forbidden|Authorization|403|Access ?denied|insufficient|nicht berechtigt") { "denied" } elseif ($m -match "not recognized|nicht erkannt|NotFound|404|license|Lizenz") { "unavailable" } else { "error" } }
function Quelle($name, [scriptblock]$blk) { Write-Host "-> $name ..." -ForegroundColor Cyan
try { & $blk; $script:R.sources[$name] = [ordered]@{ status = "ok"; atUtc = (& $jetzt) } }
catch { $script:R.sources[$name] = [ordered]@{ status = (Status $_); atUtc = (& $jetzt) }; Write-Host " nicht gelesen ($($script:R.sources[$name].status))" -ForegroundColor Yellow } }
$scopes = @(); if ($CA) { $scopes += "Policy.Read.All" }; if ($MFA) { $scopes += "AuditLog.Read.All" }; if ($Intune) { $scopes += "DeviceManagementConfiguration.Read.All","DeviceManagementManagedDevices.Read.All" }
if ($scopes.Count) { Connect-MgGraph -Scopes $scopes -NoWelcome }
if ($CA) { Quelle "conditionalAccess" {
$p = @(Get-MgIdentityConditionalAccessPolicy -All)
$mfa = @($p | Where-Object { $_.State -eq "enabled" -and ($_.GrantControls.BuiltInControls -contains "mfa") -and ($_.GrantControls.Operator -eq "AND" -or @($_.GrantControls.BuiltInControls).Count -eq 1) })
$script:R.conditionalAccess = [ordered]@{ enabledCount = @($p | Where-Object State -eq "enabled").Count; reportOnlyCount = @($p | Where-Object State -eq "enabledForReportingButNotEnforced").Count
disabledCount = @($p | Where-Object State -eq "disabled").Count; enabledWithMandatoryBuiltInMfaGrantCount = $mfa.Count } } }
if ($MFA) { Quelle "mfaRegistration" {
$u = @(Get-MgReportAuthenticationMethodUserRegistrationDetail -All)
$script:R.mfaRegistration = [ordered]@{ reportRowCount = $u.Count; registeredTrueCount = @($u | Where-Object { $_.IsMfaRegistered -eq $true }).Count; registeredUnknownCount = @($u | Where-Object { $null -eq $_.IsMfaRegistered }).Count
capableTrueCount = @($u | Where-Object { $_.IsMfaCapable -eq $true }).Count; capableUnknownCount = @($u | Where-Object { $null -eq $_.IsMfaCapable }).Count } } }
if ($Intune) { $script:R.intune = [ordered]@{ compliancePolicyCount = $null; managedDeviceCount = $null; complianceStateCounts = $null }
Quelle "intunePolicies" { $script:R.intune.compliancePolicyCount = @(Get-MgDeviceManagementDeviceCompliancePolicy -All).Count }
Quelle "intuneDevices" { $d = @(Get-MgDeviceManagementManagedDevice -All -Property "complianceState"); $c = [ordered]@{ compliant = 0; noncompliant = 0; unknown = 0; conflict = 0; error = 0; inGracePeriod = 0; configManager = 0; otherOrMissing = 0 }
foreach ($x in $d) { $k = "$($x.ComplianceState)"; if ($c.Contains($k)) { $c[$k]++ } else { $c.otherOrMissing++ } }
$script:R.intune.managedDeviceCount = $d.Count; $script:R.intune.complianceStateCounts = $c } }
if ($Audit -or $Purview) { try { Import-Module ExchangeOnlineManagement } catch { } }
if ($Audit) { Quelle "audit" { Connect-ExchangeOnline -ShowBanner:$false; $a = Get-AdminAuditLogConfig
$script:R.audit = [ordered]@{ unifiedAuditLogIngestionEnabled = $(if ($a.UnifiedAuditLogIngestionEnabled -is [bool]) { $a.UnifiedAuditLogIngestionEnabled } else { $null }) } } }
if ($Purview) { $script:R.purview = [ordered]@{ retentionPolicyCount = $null; sensitivityLabelCount = $null; sensitivityLabelPolicyCount = $null }
try { Connect-IPPSSession -ShowBanner:$false } catch { }
Quelle "purviewRetention" { $script:R.purview.retentionPolicyCount = @(Get-RetentionCompliancePolicy).Count }
Quelle "purviewLabels" { $script:R.purview.sensitivityLabelCount = @(Get-Label).Count }
Quelle "purviewLabelPolicies" { $script:R.purview.sensitivityLabelPolicyCount = @(Get-LabelPolicy).Count } }
$R | ConvertTo-Json -Depth 6 | Set-Content -Path $Ausgabe -Encoding utf8
try { Disconnect-MgGraph | Out-Null } catch { }; try { Disconnect-ExchangeOnline -Confirm:$false | Out-Null } catch { }
Write-Host "Fertig: $Ausgabe. Datei im Browser auf https://nachweis.lunafzai.com auswaehlen." -ForegroundColor Green