【发布时间】:2014-07-16 14:41:00
【问题描述】:
我有一个脚本可以在基于英语的计算机上完美运行,但不能在另一种语言中运行。
脚本获取机器 Bitlocker 的恢复密钥,然后将其备份到 Active Directory。
我已经确定我需要将“数字密码”更新为相应语言的值,但这并不会最终更改空白变量 NumericalKeyID 的输出...
Option Explicit
Dim strNumericalKeyID
Dim strManageBDE,strManageBDE2
Dim oShell
Dim StrPath
Dim StdOut, strCommand
Dim Result, TPM, strLine
Dim Flag, NumericalKeyID
Set oShell = CreateObject("WSCript.Shell")
'====================================================================================
'This section looks for the Bitlocker Key Numerical ID
strManageBDE = "Manage-BDE.exe -protectors -get c:" 'Bitlocker command to gather the ID
Flag = False
Set Result = oShell.Exec(strManageBDE)'sees the results and places it in Result
Set TPM = Result.StdOut 'Sets the variable TPM to the output if the strManageBDe command
While Not TPM.AtEndOfStream
strLine = TPM.ReadLine 'Sets strLine
If InStr(strLine, "Numerical Password:") Then ' This section looks for the Numerical Password
Flag = True
End If
If Flag = True Then
If InStr(strLine, "ID:") Then 'This section looks for the ID
NumericalKeyID = Trim(strLine)' This section trims the empty spaces from the ID {} line
NumericalKeyID = Right(NumericalKeyID, Len(NumericalKeyID)-4)
Flag = False 'Stops the other lines from being collected
End If
End If
Wend
strManageBDE2 = "Manage-BDE.exe -protectors -adbackup C: -ID " & NumericalKeyID
oShell.Run strManageBDE2, 0, True 'Runs the Manage-bde command to move the numerical ID to AD.
我确信这很愚蠢,但我的脚本知识很新。
非常感谢! :)
manage-bde 的英文输出:
【问题讨论】:
-
您使用的是什么操作系统?它必须在 VBScript 中吗?
-
Windows 7。我尝试过 Powershell,但 BitLocker cmdlet 仅适用于 Windows 8 及更高版本的 Powershell v3。
-
能否添加来自 Manage-BDE.exe 的输出(混淆敏感位)?我手边没有启用 Bitlocker 的机器
-
为什么不使用 Manage-BDE.exe -protectors -adbackup C 将所有密钥备份到 AD:您不必指定 -ID 参数
-
不,跳过整个脚本,只运行 Manage-BDE.exe -protectors -adbackup C:这将备份所有保护器,而不仅仅是单个保护器。您是否特别需要仅备份其中一个保护器?