繁体   English   中英

Powershell - 无法解锁 BitLocker,因为 256 个字符的长密码包含带有单双引号的特殊字符

[英]Powershell - Can't unlock BitLocker as 256 characters long password contains special characters with single double quotes

这是背景,除此之外我没有任何线索,所以请告诉我如何继续前进!

PS C:\> $SecureString = ConvertTo-SecureString "fjuksAS1337" -AsPlainText -Force

PS C:\> Unlock-BitLocker -MountPoint "E:" -Password $SecureString

我这里的密码是:

cF;TA" X%jl"\G{d}rcVzNI=Inps#|P,o{~"k<+@?bm)PjQf^\c8EB! (cL.ZyA.v/yYQ#,!#gN'%"VwlNFs)(h\1Uf@cFdr7BU%zDA;&2R_3w3C3td-Nm,^VFE$cF>N{ol0Y~qR2i`Vm%Q@ckh0]#ZE!ijnirg5k?bj\L;88wBhg8QqO^/T64D@O6Q'H"")/I5(d4v7RC`jH=JH+,Zy*TY4MEf~.b7?;';zLEmB>F^S7aBrUfnN&(Vuhjw}Z3w5

如您所见,它有多个单引号和双引号,这会破坏 SecureString 命令输出无处可去。

我需要使用此密码来解锁 BitLocker 驱动器,因为 UI 会抛出错误的密码错误,并且 48 位的恢复密码很遗憾丢失了!

请帮忙,因为我根本不知道这里!

使用单引号此处的字符串。 你放在那里的任何东西都不会以任何方式逃脱。

例子

$PlainTextPassword = @'
cF;TA" X%jl"\G{d}rcVzNI=Inps#|P,o{~"k<+@?bm)PjQf^\c8EB! (cL.ZyA.v/yYQ#,!#gN'%"VwlNFs)(h\1Uf@cFdr7BU%zDA;&2R_3w3C3td-Nm,^VFE$cF>N{ol0Y~qR2i`Vm%Q@ckh0]#ZE!ijnirg5k?bj\L;88wBhg8QqO^/T64D@O6Q'H"")/I5(d4v7RC`jH=JH+,Zy*TY4MEf~.b7?;';zLEmB>F^S7aBrUfnN&(Vuhjw}Z3w5
'@

$SecureString = ConvertTo-SecureString $PlainTextPassword -AsPlainText -Force

快速参考:


# verbatim string. Nothing get processed. Single-quotes within the string need to 
# be doubled down.
$sq = 'Hello '' world.'

# Expandable string. Stuff that can be expanded will be.
# Double-quotes within the string need to be doubled down or preceded by a backtick `
$dq = "Hello `" "" world"

# verbatim here string. single-quotes within the string do not need to be escaped
# This is the way to go for multiline strings
$sqh = @'
Hello ' World
'@

# Expandable here string. Double quotes within the string do not need to be escaped.
# This is the way to go for multiline strings
$dqh = @"
Hello " World
"@

参考

关于_报价_规则

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM