Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在尝试从工作流中的powershell安装sharepoint系统必备组件 编辑:_Powershell_Sharepoint - Fatal编程技术网

正在尝试从工作流中的powershell安装sharepoint系统必备组件 编辑:

正在尝试从工作流中的powershell安装sharepoint系统必备组件 编辑:,powershell,sharepoint,Powershell,Sharepoint,这个问题是在没有完全理解.exe实际返回的内容的情况下提出的。代码片段实际上返回了它应该返回的内容 原始问题: 代码: 我总是从$prereqResults返回一个-1,它似乎安装了一些东西,然后出错,而它应该再次运行和/或给我一个不同的退出代码。我不相信我得到了正确的退出代码 如果我没有指定ExitCode属性,prereqResults将返回如下结果: @{Path=; Company=; CPU=0.0625; FileVersion=; ProductVersion=; Descript

这个问题是在没有完全理解.exe实际返回的内容的情况下提出的。代码片段实际上返回了它应该返回的内容

原始问题: 代码:

我总是从
$prereqResults
返回一个
-1
,它似乎安装了一些东西,然后出错,而它应该再次运行和/或给我一个不同的退出代码。我不相信我得到了正确的退出代码

如果我没有指定ExitCode属性,prereqResults将返回如下结果:

@{Path=; Company=; CPU=0.0625; FileVersion=; ProductVersion=; Description=;     Product=; __NounName=Process; PSComputerName=localhost;     RunspaceId=a62e33ea-5f4c-4cae-85a4-d1426efacced;     PSShowComputerName=True;     PSSourceJobInstanceId=b2624e9f-5584-4874-a5b3-a9745f95bf42; ExitCode=-1; HasExited=True; ExitTime=03/20/2017 13:12:31;           Handle=2504;     SafeHandle=Microsoft.Win32.SafeHandles.SafeProcessHandle; Id=2980;     MachineName=.; PrivilegedProcessorTime=00:00:00.0625000;         StartInfo=System.Diagnostics.ProcessStartInfo; StartTime=03/20/2017 13:12:30;     SynchronizingObject=; Total
ProcessorTime=00:00:00.0625000; UserProcessorTime=00:00:00;     EnableRaisingEvents=False; Site=; Container=}

有人能帮我弄清楚如何正确运行和返回退出代码吗?

尝试写入输出$prereqResult,检查属性名称是否与“ExitCode”相同,也尝试写入输出$prereqResult.PSSourceJobInstanceId

如果显示正确,则将其推送到变量并返回该变量,或使用选择字符串模式“ExitCode”

希望它能起作用

@{Path=; Company=; CPU=0.0625; FileVersion=; ProductVersion=; Description=;     Product=; __NounName=Process; PSComputerName=localhost;     RunspaceId=a62e33ea-5f4c-4cae-85a4-d1426efacced;     PSShowComputerName=True;     PSSourceJobInstanceId=b2624e9f-5584-4874-a5b3-a9745f95bf42; ExitCode=-1; HasExited=True; ExitTime=03/20/2017 13:12:31;           Handle=2504;     SafeHandle=Microsoft.Win32.SafeHandles.SafeProcessHandle; Id=2980;     MachineName=.; PrivilegedProcessorTime=00:00:00.0625000;         StartInfo=System.Diagnostics.ProcessStartInfo; StartTime=03/20/2017 13:12:30;     SynchronizingObject=; Total
ProcessorTime=00:00:00.0625000; UserProcessorTime=00:00:00;     EnableRaisingEvents=False; Site=; Container=}