【发布时间】:2019-02-28 20:30:59
【问题描述】:
我有一个在 Windows Server 2012 R2 的 Powershell 4.0 中运行的脚本。 现在我安装了 Windows Server 2016,我有 Powershell V5.1.17134.590。
在我的脚本中我有这个:
$credFile = "c:\Program Files\Scripts\MyCredentials.xml"
$credentials = Import-Clixml $credFile
return $credentials
这是我的 MyCredentials.xml:
<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">corp\tfsservice</S>
<SS N="Password">01000000d08c9ddf0115d1118c7a00c04fc297eb01000000f64c30e2720cc64c970ed0d8972b88400000000002000000000003660000c000000010000000bd0a6bf0e5025f1ae6ba8d5b9637db0400000000048</SS>
</Props>
</Obj>
</Objs>
现在我很困惑,因为在我的旧机器(windows server 2012 R2)中,当我运行脚本时,我得到了这个:
如您所见,命令运行成功。
但是在我的 Windows Server 2016 机器上,当我运行相同的脚本时,我得到了这个:
我不明白为什么现在这不起作用。
谁能帮帮我?
【问题讨论】:
-
Import-CliXml隐式解密安全字符串,默认加密密钥绑定到最初运行Export-CliXml的机器 -
我明白了。知道如何找到加密密钥并将其复制到我的新机器上吗?
-
我会尝试在旧机器上解密,然后在新机器上重新加密。
-
@marsze 说了什么 ^
标签: powershell powershell-4.0 powershell-v5.1