簡體   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