我正在尝试创建一个.vbs脚本,该脚本将回显计算机C驱动器的BitLocker状态。
我尝试使用以下代码,但收到错误0X80041003,来源:(空)。
strComputer = "."
Set objShell = CreateObject("Wscript.Shell")
strEnvSysDrive = objShell.ExpandEnvironmentStrings("%SystemDrive%")
Set objWMIServiceBit = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
Set colItems = objWMIServiceBit.ExecQuery("SELECT * FROM Win32_EncryptableVolume",,48)
For Each objItem in colItems
If objItem.DriveLetter = strEnvSysDrive Then
strDeviceC = objItem.DeviceID
DriveC = "Win32_EncryptableVolume.DeviceID='"&strDeviceC&"'"
Set objOutParams = objWMIServiceBit.ExecMethod(DriveC, "GetProtectionStatus")
If objOutParams.ProtectionStatus = "1" Then
wscript.Echo "Bitlocker is enabled"
Else
wscript.Echo "Bitlocker is disabled"
End if
End If
Next
有人知道为什么我继续出现此错误,或者有任何.vbs脚本会回显C驱动器的BitLocker状态吗?