VBScript调用WMI判断系统分区是否被BitLocker加密

rem=========== check if system partition is bitlockered
rem=========== ©tunpishuang http://tunps.com
rem=========== return 0:not locked, none-0:locked
dim emval, em, psval, ps, drv
Dim fso,sysVol
Dim outFile
Const windir = 0
Const tmpdir = 0
rem ::get system volume
arrComputers = Array(".")
Set fso = CreateObject("Scripting.FileSystemObject")
Set tfolder = fso.GetSpecialFolder(windir)
Set tTmpfolder = fso.GetSpecialFolder(tmpdir)
sysVol = Mid(tfolder, 1, 2)
For Each strComputer In arrComputers
  Set objWMIService = GetObject("winmgmts:\\" & strComputer _
                 & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
  Set volumes = objWMIService.InstancesOf("Win32_EncryptableVolume")
    for each volume In volumes
        emval = volume.GetEncryptionMethod(em)
        psval = volume.GetProtectionStatus(ps)
        drv = volume.DriveLetter
        if drv = sysvol then
            wscript.quit em
        end if
    Next
Next

发表评论

电子邮件地址不会被公开。 必填项已用*标注