跳转到主要内容
BitLocker 密钥、轮换本地管理员密码、第三方 UID 等。 你可以通过脚本写入自定义资产字段。这对于 BitLocker 密钥、轮换本地管理员密码和第三方 UID 等很有用。
1

创建自定义资产字段

  1. 导航到 Settings > Assets > Custom Fields
  2. 添加自定义字段,详细信息如下:
  • Name:BitLocker Recovery Key
  • Variable:bitlockerRecoveryKey
Image
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. 保存并分发策略。