Intune Initial Scripts Backup

This commit is contained in:
2025-04-21 14:21:38 -04:00
commit 71764cd10f
241 changed files with 28218 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
### remediation script ###
### backup recovery key of systemdrive
try{
### obtain protected system volume
$BLSysVolume = Get-BitLockerVolume -MountPoint $env:SystemDrive
$BLRecoveryProtector = $BLSysVolume.KeyProtector | Where-Object { $_.KeyProtectorType -eq 'RecoveryPassword' }
$BLprotectorguid = $BLRecoveryProtector.KeyProtectorId
# Backup sysdrive recovery key to AAD
BackuptoAAD-BitLockerKeyProtector -MountPoint $env:SystemDrive -KeyProtectorId $BLRecoveryProtector.KeyProtectorID -ErrorAction Stop
Exit 0
}
catch
{
$errMsg = $_.Exception.Message
Write-Output $errMsg
exit 1
}