الانتقال إلى المحتوى الرئيسي
مفاتيح BitLocker، تدوير كلمة مرور المسؤول المحلي، معرف UID لجهة خارجية، إلخ. يمكنك الكتابة إلى حقل أصل مخصص عبر النصوص البرمجية. هذا مفيد لأشياء مثل مفاتيح BitLocker، وتدوير كلمات مرور المسؤول المحلي، ومعرفات UID لجهات خارجية.
1

إنشاء حقل أصل مخصص

  1. انتقل إلى Settings > Assets > Custom Fields.
  2. أضف حقلًا مخصصًا بالتفاصيل التالية:
  • Name: BitLocker Recovery Key
  • Variable: bitlockerRecoveryKey
صورة
2

إنشاء النص البرمجي

  1. انتقل إلى Scripts.
  2. أنشئ نصًا برمجيًا بالتفاصيل التالية:
  • Name: 🗝️Store-BitlockerRecoveryKey
  • Content:
$ErrorActionPreference = 'SilentlyContinue' 

# Get drives where BitLocker is "On" 
$BitlockerDrives = Get-BitLockerVolume | Where-Object ProtectionStatus -EQ "On" -ErrorAction SilentlyContinue

#Get FileSystem drives 
$Drives = Get-PSDrive -PSProvider FileSystem

#Create array of Drive Names with ":" added
$DrivesName = @()
$Drives |  foreach {$DrivesName += $_.name + ':' }

#If any Bitlockered drives exist
if($BitlockerDrives){

    #Foreach Drive
    Foreach ($DriveName in $DrivesName) {

        #Confirm is drive is bitlockered
        $BitlockerDrive = $BitlockerDrives | where { $DriveName -contains $_ }

        #If specific drive is bitlockered
        if ($BitlockerDrive){

            #Get RecoveryKey 
            $RecoveryKey = $BitlockerDrive.KeyProtector | Where-Object RecoveryPassword -NE "" | Select-Object -ExpandProperty RecoveryPassword -ErrorAction SilentlyContinue
      
            #Join if multiple with ; delimiter 
            $RecoveryKey = $RecoveryKey -join ";"

            #Add the drive letter to the output
            $RecoveryKey = "$($BitlockerDrive.mountpoint)$RecoveryKey"

            #Add to other drive keys (If exist)
            $RecoveryKeys += " $RecoveryKey "

        } else { $RecoveryKeys += $DriveName + "Not Enabled" }   
        
    }

    GoreloAction -SetCustomField -Name 'asset.bitlockerRecoveryKey' -Value $RecoveryKeys

#If no bitlockered drives found
}else { 
    
    Foreach ($DriveName in $DrivesName) { 
        
        $RecoveryKeys += $DriveName + "Not Enabled " 
        
    } 
    
    GoreloAction -SetCustomField -Name 'asset.bitlockerRecoveryKey' -Value $RecoveryKeys 
    
}
3

نشر النص البرمجي عبر سياسة.

  1. انتقل إلى Policies.
  2. عدّل سياسة موجودة تغطي الأصول التي تريد تخزين المفاتيح أو العناوين لها.
  3. أضف النص البرمجي وعيّنه ليتكرر يوميًا في الوقت المفضل لديك.
  4. احفظ ووزّع السياسة.