下面是我的代码:
function Execute-Script($path) {
$key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
trap { "failed"; break }
$raw = Get-Content $path
$secure = ConvertTo-SecureString $raw -Key $key
$helper = New-Object system.Management.Automation.PSCredential("asapkal", $secure)
$plain = $helper.GetNetworkCredential().Password
Invoke-Expression $plain
}
Execute-Script "D:\PDMReport\PDMReport.bin" 我得到了下面的错误:
Invoke-Expression : Cannot bind parameter 'Start' to the target. Exception setting "Start": "Cannot convert null to type "System.DateTime"."
At line:8 char:3
+ Invoke-Expression $plain
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Invoke-Expression], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.InvokeExpressionCommand请帮助解决此问题,我尝试以管理员身份运行ISE,但错误仍然存在。
发布于 2020-04-15 05:18:50
使用Write-Host $plain而不是Invoke-Expression $plain,您将看到问题所在。
如果仍然不清楚,请在此处发布输出(如果不是机密的),您可能会获得进一步的帮助。
https://stackoverflow.com/questions/61214446
复制相似问题