我们在Windows上使用Splunk,并且在最新版本中,我们现在需要将我们的脚本警报迁移到自定义警报。长话短说,新的框架不再使用位置参数,而是使用有效载荷(stdin)。如果使用Python很简单,如图Spunk documentation什么是Powershell相当于Pythons sys.stdin.read()?
settings = json.loads(sys.stdin.read())
我一直无法弄清楚我该怎么办的使用PowerShell相同。 cmdlet只读主机只能从键盘读取stdin。我还发现使用该cmdlet获取内容从标准输入读取的例子,但是在使用exsisting文件时
Get-Content c:\scripts\test.txt
这可能是我需要做相关的正在发生的事情说明什么,我只找到实例this accepted answer。
$psi = New-Object System.Diagnostics.ProcessStartInfo;
....
....
但我不想发送到另一个进程的标准输入,我想读什么另一个进程已发送到“我”的过程中,PowerShell的脚本。
确实[此帖](https://stackoverflow.com/questions/44371646/redirect-standard-input-read-host-to-a-powershell-script/44371797)#44371797)有帮助吗?不知道是否直接重复。 – gms0ulman