0
我正在用密碼加密的.xml文件中存儲用戶名和密碼。當我嘗試添加另一個用戶名和密碼時,它會覆蓋第一個。我如何附加追加現有的文件?將加密密碼存儲在xml中
$username = "user"
$password = "password1" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $username,($password | ConvertTo-SecureString)
$cred | Export-Clixml C:\file.xml
我很難理解所提供的答案。我嘗試了幾個不同的值,我應該用什麼來代替Node?
<Objs Version="1.1.0.1"xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<TN RefId="0">
<T>System.Management.Automation.PSCredential</T>
<T>System.Object</T>
</TN>
<ToString>System.Management.Automation.PSCredential</ToString>
<Props>
<S N="UserName">Tom</S>
<SS N="Password">01000000d08c9ddf0115d1118c7a00c04fc297eb01000000fbc3e29e463de248a4643396e70cd6670000000002000000000003660000c0000000100000005f32bf40a436abd21b2855a28a7930f10000000004800000a000000010000000f4d23943a843968368a273547091233b1800000061921de936aa6f7952ef38c53de64f22dcad44e75836a01514000000d50a8b31c7c3a242e82f3c8c1c1105f1431f2a01</SS>
</Props>
</Obj>
</Objs>
「當我嘗試添加另一個」時,你的意思是? –
將另一個用戶名和密碼添加到文件中 – stvnmil