發表文章

目前顯示的是 11月 15, 2018的文章

President

圖片
This article is about a position and title in government. For the highest officer of a corporation, see President (corporate title). For the system of government, see Presidential system. For other uses, see President (disambiguation). Part of the Politics series on Executive government Head of state Monarch Supreme leader President President of the Council of State Government Head of government Chancellor Chief executive Chief minister First minister Premier Prime minister President of the Council of Ministers Cabinet Cabinet collective responsibility Ministry Minister Secretary Other Governor Mayor Systems Monarchy (Constitutional) Republic (Parliamentary) Directorial Parliamentary (Westminster) Semi-parliamentary ( simul simul ) Semi-presidential (cohabitational) Presidential Lists National governments Heads of state and government Politics portal v t e The pres

PowerShell property Count cannot be found on this object

圖片
up vote 2 down vote favorite I am trying to count some lines output by a command. Basically all the lines which end in " Y " in this example. Fist Capture the command results: PS> $ItsAgents = tacmd listSystems -n Primary:SomeHost:NT PS> $ItsAgents Managed System Name Product Code Version Status Primary:SomeHost:NT NT 06.30.07.00 Y SomeHost:Q7 Q7 06.30.01.00 N Now count the online ones: PS> $AgentCount = ($ItsAgents | Select-String ' Y ').Count PS> $AgentCount 1 Now that all works as I expect. So I put it in my script like this: $ItsAgents = tacmd listSystems -n $agent Write-Host $ItsAgents $BeforeCount = ($ItsAgents | Select-String ' Y ').Count And when the script runs (under Set-StrictMode ) I get: The property 'Count'