我可以在 powershell 中运行 puppet bolt 命令。在powershell中,我得到如下输出
开始于 winrm://remotemachine
在 winrm://remotemachine 上完成
STDOUT: RemoteMachineHostName
在 1 个目标上成功在 3.2 秒内在 1 个目标上运行
我的 C# 如下
PowerShell ps = PowerShell.Create();
ps.AddScript("C:\\User1\\GetRemoteAzureVMHostName.ps1");
Collection<PSObject> results = ps.Invoke(); // in results, I'm getting value as 0.
foreach (PSObject result in results)
{
//Do something
}
我尝试在 Visual Studio 2019 中将构建平台目标更改为 x64,但没有成功。
如何解决上述问题
更新1:
我在 powershell 脚本中使用了以下命令。
bolt command run hostname --targets winrm://158.28.0.546 --no-ssl-verify --user testuser123 --password test@84p