if($PSCmdlet.ShouldProcess("$($dbRecord.DeviceId)","DB Record Update - LastContactWithEntra")){
$updateDateQuery="UPDATE $($dbConfig.TableName) SET LastContactWithEntra='$($entraRecord.ApproximateLastSignInDateTime)' WHERE DeviceId='$($encryptionID.Value.DeviceId)'"
$null=Send-SqlQuery($updateDateQuery)
}
}
}
Write-Progress-Completed-Activity"Updating attribute Last Contact With Entra for DB Records"
Write-Host"Updated Last Contact With Entra ID for $updatedDBrecordsCount records in DB."-ForegroundColorGreen
#[PART 2] - Backup missing recovery Keys to SQL DB
#Load All Bitlocker IDs from Entra
Write-Host"Downloading all encrypted devices from Entra ID ..."-ForegroundColorYellow