Lese-Skript (nur lesen)
Das Skript verwendet ausschließlich Get-Befehle von Microsoft Graph PowerShell, ändert nichts in Ihrem Tenant und sendet nichts an uns. Es schreibt eine Datei copilot-startklar.json mit Zahlen und Einstellungen, ohne Namen und E-Mail-Adressen.
Skript herunterladen Anleitung
<#
Copilot-Startklar-Scan - Lese-Skript (nur lesen, keine Aenderungen)
Luna group L.L.C-FZ, Dubai - https://copilotscan.lunafzai.com
Version 1.0 (26.11.2026)
Was es tut: Liest Einstellungen Ihres Microsoft-365-Tenants mit Microsoft Graph PowerShell
(nur Get-Befehle) und schreibt EINE Datei "copilot-startklar.json" auf Ihren PC.
Was es NICHT tut: Es aendert nichts, legt keine App an, sendet nichts an uns.
Die JSON-Datei enthaelt nur Zahlen und Einstellungen, keine Namen, keine E-Mail-Adressen.
Sie laden sie selbst im Browser; sie wird dort lokal ausgewertet.
Voraussetzungen: PowerShell 5.1 oder 7, Modul Microsoft.Graph (Install-Module Microsoft.Graph -Scope CurrentUser),
Anmeldung als Globaler Leser (Global Reader) oder Administrator.
Optional: -SharePointAdminUrl https://IHRTENANT-admin.sharepoint.com (Modul Microsoft.Online.SharePoint.PowerShell)
-Audit (Modul ExchangeOnlineManagement, prueft das Ueberwachungsprotokoll)
Aufruf: .\copilot-startklar.ps1
.\copilot-startklar.ps1 -SharePointAdminUrl https://contoso-admin.sharepoint.com -Audit
#>
param([string]$SharePointAdminUrl = "", [switch]$Audit, [string]$Ausgabe = ".\copilot-startklar.json")
$ErrorActionPreference = "Stop"
$R = [ordered]@{ format = "luna-copilot-startklar"; version = 1; erstellt = (Get-Date).ToUniversalTime().ToString("o"); fehler = @() }
function Teil($name, [scriptblock]$blk) { Write-Host "-> $name ..." -ForegroundColor Cyan; try { & $blk } catch { $script:R.fehler += "$($name): $($_.Exception.Message)"; Write-Host " nicht lesbar: $($_.Exception.Message)" -ForegroundColor Yellow } }
Write-Host "Anmeldung bei Microsoft Graph (nur Leserechte) ..." -ForegroundColor Cyan
Connect-MgGraph -NoWelcome -Scopes "Organization.Read.All","User.Read.All","Directory.Read.All","Policy.Read.All","RoleManagement.Read.Directory","Group.Read.All","AuditLog.Read.All"
Teil "Lizenzen" {
$skus = Get-MgSubscribedSku -All
$script:SkuMap = @{}; foreach ($s in $skus) { $script:SkuMap[[string]$s.SkuId] = $s.SkuPartNumber }
$script:R.skus = @($skus | ForEach-Object { [ordered]@{ teil = $_.SkuPartNumber; aktiv = $_.PrepaidUnits.Enabled; vergeben = $_.ConsumedUnits } })
}
Teil "Benutzer" {
$u = Get-MgUser -All -Property "UserType,AccountEnabled,AssignedLicenses"
$m = @($u | Where-Object { $_.UserType -ne "Guest" })
$kombi = @{}
foreach ($x in $m) {
if (-not $x.AccountEnabled) { continue }
$t = @($x.AssignedLicenses | ForEach-Object { $script:SkuMap[[string]$_.SkuId] } | Where-Object { $_ } | Sort-Object) -join "+"
if ($t) { if ($kombi.ContainsKey($t)) { $kombi[$t]++ } else { $kombi[$t] = 1 } }
}
$script:R.benutzer = [ordered]@{ mitglieder = $m.Count; gaeste = @($u | Where-Object { $_.UserType -eq "Guest" }).Count
deaktiviert = @($m | Where-Object { -not $_.AccountEnabled }).Count; lizenziert = @($m | Where-Object { $_.AccountEnabled -and $_.AssignedLicenses.Count -gt 0 }).Count
lizenzKombinationen = @($kombi.GetEnumerator() | ForEach-Object { [ordered]@{ teile = $_.Key; anzahl = $_.Value } }) }
}
Teil "Sicherheitsstandards" { $script:R.sicherheitsstandards = (Get-MgPolicyIdentitySecurityDefaultEnforcementPolicy).IsEnabled }
Teil "Bedingter Zugriff" {
$p = @(Get-MgIdentityConditionalAccessPolicy -All)
$an = @($p | Where-Object { $_.State -eq "enabled" })
$mfa = @($an | Where-Object { ($_.GrantControls.BuiltInControls -contains "mfa") -or $_.GrantControls.AuthenticationStrength.Id })
# "fuer alle" nur wenn: alle Benutzer + alle Apps, und MFA ist Pflicht (einziges Steuerelement oder UND-Verknuepfung)
$alle = @($mfa | Where-Object { ($_.Conditions.Users.IncludeUsers -contains "All") -and ($_.Conditions.Applications.IncludeApplications -contains "All") -and
(($_.GrantControls.Operator -eq "AND") -or (@($_.GrantControls.BuiltInControls).Count -le 1)) })
$aus = 0; foreach ($x in $alle) { $n = @($x.Conditions.Users.ExcludeUsers).Count + @($x.Conditions.Users.ExcludeGroups).Count + @($x.Conditions.Users.ExcludeRoles).Count; if ($n -gt $aus) { $aus = $n } }
$script:R.bedingterZugriff = [ordered]@{ gesamt = $p.Count; aktiv = $an.Count; mfaRichtlinien = $mfa.Count; mfaFuerAlle = $alle.Count; maxAusnahmen = $aus
nurBericht = @($p | Where-Object { $_.State -eq "enabledForReportingButNotEnforced" }).Count }
}
Teil "Administratorrollen" {
$ga = Get-MgDirectoryRole -Filter "roleTemplateId eq '62e90394-69f5-4237-9190-012177145e10'"
$ids = @(); if ($ga) { $ids = @(Get-MgDirectoryRoleMember -DirectoryRoleId $ga.Id -All | ForEach-Object { $_.Id }) }
$priv = @{}; foreach ($r in Get-MgDirectoryRole -All) { foreach ($mm in Get-MgDirectoryRoleMember -DirectoryRoleId $r.Id -All) { $priv[$mm.Id] = 1 } }
$script:R.admins = [ordered]@{ globaleAdmins = $ids.Count; privilegierteKonten = $priv.Count }
$script:PrivIds = @($priv.Keys)
}
Teil "MFA-Registrierung" {
$reg = @(); $uri = "https://graph.microsoft.com/v1.0/reports/authenticationMethods/userRegistrationDetails?`$select=id,isMfaRegistered,isAdmin,userType"
while ($uri) { $res = Invoke-MgGraphRequest -Method GET -Uri $uri; $reg += $res.value; $uri = $res.'@odata.nextLink' }
$mem = @($reg | Where-Object { $_.userType -ne "guest" }); $adm = @($reg | Where-Object { $script:PrivIds -contains $_.id })
$script:R.mfa = [ordered]@{ mitglieder = $mem.Count; mitgliederMfa = @($mem | Where-Object { $_.isMfaRegistered }).Count; admins = $adm.Count; adminsMfa = @($adm | Where-Object { $_.isMfaRegistered }).Count }
}
Teil "App-Einwilligung" {
$a = Get-MgPolicyAuthorizationPolicy
$script:R.appEinwilligung = @($a.DefaultUserRolePermissions.PermissionGrantPoliciesAssigned)
$script:R.benutzerDuerfenAppsRegistrieren = $a.DefaultUserRolePermissions.AllowedToCreateApps
}
Teil "Gruppeneinstellungen" {
$gs = @(Get-MgGroupSetting -All | Where-Object { $_.DisplayName -eq "Group.Unified" })
$o = [ordered]@{ vorhanden = ($gs.Count -gt 0) }
if ($gs.Count) { foreach ($v in $gs[0].Values) { if ($v.Name -in "EnableGroupCreation","AllowGuestsToAccessGroups","AllowGuestsToBeGroupOwner","AllowToAddGuests") { $o[$v.Name] = $v.Value } } }
$script:R.gruppen = $o
$script:R.m365Gruppen = @(Get-MgGroup -All -Filter "groupTypes/any(c:c eq 'Unified')" -Property "Id,Visibility" | Group-Object Visibility | ForEach-Object { [ordered]@{ sichtbarkeit = [string]$_.Name; anzahl = $_.Count } })
}
if ($SharePointAdminUrl) {
Teil "SharePoint" {
if ($PSVersionTable.PSEdition -eq "Core") { Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell -WarningAction SilentlyContinue } else { Import-Module Microsoft.Online.SharePoint.PowerShell -WarningAction SilentlyContinue }
Connect-SPOService -Url $SharePointAdminUrl
$t = Get-SPOTenant
$o = [ordered]@{ freigabe = [string]$t.SharingCapability; standardLink = [string]$t.DefaultSharingLinkType; jederLinkAblaufTage = $t.RequireAnonymousLinksExpireInDays; standardLinkBerechtigung = [string]$t.DefaultLinkPermission }
try { $o.eingeschraenkteSuche = [string](Get-SPOTenantRestrictedSearchMode).Mode } catch { $o.eingeschraenkteSuche = "unbekannt" }
$sites = @(Get-SPOSite -Limit All)
$o.websites = $sites.Count
$o.websitesFreigabe = @($sites | Group-Object SharingCapability | ForEach-Object { [ordered]@{ stufe = [string]$_.Name; anzahl = $_.Count } })
$o.websitesMitBezeichnung = @($sites | Where-Object { $_.SensitivityLabel }).Count
$script:R.sharepoint = $o
}
}
if ($Audit) {
Teil "Ueberwachungsprotokoll" { Connect-ExchangeOnline -ShowBanner:$false; $script:R.auditAktiv = (Get-AdminAuditLogConfig).UnifiedAuditLogIngestionEnabled; Disconnect-ExchangeOnline -Confirm:$false }
}
$R | ConvertTo-Json -Depth 6 | Out-File -FilePath $Ausgabe -Encoding utf8
Write-Host ""
Write-Host "Fertig: $((Resolve-Path $Ausgabe).Path)" -ForegroundColor Green
Write-Host "Die Datei enthaelt keine Namen und keine E-Mail-Adressen. Laden Sie sie auf der Seite im Browser; sie verlaesst Ihren PC nicht." -ForegroundColor Green
if ($R.fehler.Count) { Write-Host "$($R.fehler.Count) Bereich(e) waren nicht lesbar und werden als 'unbekannt' bewertet." -ForegroundColor Yellow }
Disconnect-MgGraph | Out-Null