[英]Powershell - Can't unlock BitLocker as 256 characters long password contains special characters with single double quotes
Here's the background and I have no clue beyond this so tell me how to move ahead from this!这是背景,除此之外我没有任何线索,所以请告诉我如何继续前进!
PS C:\> $SecureString = ConvertTo-SecureString "fjuksAS1337" -AsPlainText -Force
PS C:\> Unlock-BitLocker -MountPoint "E:" -Password $SecureString
My password here is:我这里的密码是:
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
As you see it has multiple single and double quotes which breaks the SecureString command output getting nowhere.如您所见,它有多个单引号和双引号,这会破坏 SecureString 命令输出无处可去。
I need to use this password in order to unlock BitLocker drive as the UI throws wrong password error and recovery password of 48 digits is unfortunately lost!我需要使用此密码来解锁 BitLocker 驱动器,因为 UI 会抛出错误的密码错误,并且 48 位的恢复密码很遗憾丢失了!
Please help as I am having no idea here at all!请帮忙,因为我根本不知道这里!
Use a single-quoted here-string.使用单引号此处的字符串。 Anything you put in there won't be escaped in any way.你放在那里的任何东西都不会以任何方式逃脱。
Example例子
$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
For a quick reference:快速参考:
# 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
"@
Reference参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.