我有一个在 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 机器上,当我运行相同的脚本时,我得到了这个:
我不明白为什么这现在不起作用。
谁能帮我?