我似乎無法理解如何獲取在powershell中的最終表上顯示的先前的命令對象。我明白我沒有解釋自己說好了,所以我會用例子:)Powershell - 從以前的命令中選擇對象
get-dhcpserverv4scope -computername server01
去這將返回我是這樣的:
ScopeID,子網掩碼,名稱
10.0 .10.0,255.255.255.0,Scope1
10.5.0.0,255.255.248.0,Scope2
現在,當我運行此相反,我不能讓ScopeID與第二命令來顯示結果:
get-dhcpserverv4scope -computername server01 | ForEach-Object {get-dhcpserverv4optionvalue -computername server01 -scopeid $_.scopeid} | where {$_.OptionID -like "6"} | Select-Object Name, OptionID, Value
我明顯得到從get-dhcpserverv4optionvalue中選擇對象。我怎樣才能得到包含在最新的Select-Object中的ScopeID? 它實際上可能嗎?
感謝
謝謝,這個作品! :) – Simone
要查看最後一個對象的成員,您可以用get-member替換上一個選擇對象。然後你會看到該物業是否存在。如果它存在,那麼它的值可能爲空。 –