我們在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