PowerShell powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddScript("[System.Net.ServicePointManager]::ServerCertificateValidationCallback+={$true}");
这是正确的吗?
下一步是什么?
PowerShell powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddScript("[System.Net.ServicePointManager]::ServerCertificateValidationCallback+={$true}");
这是正确的吗?
下一步是什么?
来自MSDN:
PSCommand command = new PSCommand();
command.AddScript(
"[System.Net.ServicePointManager]::ServerCertificateValidationCallback+={$true}"
);
PowerShell powershell = PowerShell.Create();
powershell.Commands = cmd;
var results = powershell.Invoke();
powershell.Commands = cmd;
应该改为 powershell.Commands = command;
,是吗? - Jimmy D
powershell.Invoke()
。 - Peter K.