דלג לתוכן

סקריפט לייצוא מפתחות שחזור BitLocker של מכשירי Windows מנוהלים ל-CSV

פורסם ב-9 במאי 2025

הסקריפט הזה מתחבר ל-Microsoft Graph API עבור tenant מסוים, שולף מפתחות שחזור BitLocker של כל מכשירי Windows המנוהלים, ומייצא אותם לקובץ CSV. הוא מביא פרטים כמו מזהי מפתחות, תאריכי יצירה ומזהי מכשירים, ואז מצליב את הנתונים האלה עם מידע ממכשירים מנוהלים, כמו שמות מכשירים, תאריכי סנכרון אחרון ומצב הצפנה. את מערך הנתונים שמתקבל הוא מייצא לקובץ CSV, כך שקל לעקוב אחרי מפתחות שחזור BitLocker ולנהל אותם בכל מכשירי ה-tenant.

<#
.SYNOPSIS
Exports BitLocker recovery keys for all managed Windows devices in the specified tenant to a CSV file.
.DESCRIPTION
This function connects to Microsoft Graph API using the specified tenant ID and scopes, retrieves BitLocker recovery keys for all managed Windows devices in the tenant, and exports them to a CSV file.
.PARAMETER TenantId
The ID of the tenant to connect to. Default value is "oncld.io".
.PARAMETER FilePath
The path of the CSV file to export the BitLocker recovery keys to. Default value is "$home\download\$TenantId-BitlockerKeys.csv".
.EXAMPLE
Export-BitLockerRecoveryKeys -TenantId "contoso.onmicrosoft.com" -FilePath "C:\temp\BitLockerKeys.csv"
This command exports BitLocker recovery keys for all managed Windows devices in the "contoso.onmicrosoft.com" tenant to a CSV file named "BitLockerKeys.csv" in the "C:\temp" directory.
.NOTES
Requires the Microsoft.Graph.Authentication, Microsoft.Graph.Identity.SignIns, Microsoft.Graph.DeviceManagement, and JoinModule modules.
#>
function Export-BitLockerRecoveryKeys {
param (
[string]$TenantId = "xxx.com",
[string]$FilePath = "$home\Downloads\$