PowerShell Counting Objects
🫧 Open on Bubbles Why I Replaced .Count with Measure-Object in My PowerShell Code. I tried the .Count and it kept returning 0 when I knew there was more than one in the count. This caused problems when I needed to count if there was great then 0 or 1 items, and .Count was unreliable. Moving to Measure-Object was, and this is why. Recently, I made a small change throughout some PowerShell code that looked like this: "CriticalIssues" = ( $issues | Where-Object { $_ . Severity -eq "Critical" } ) . Count and ch
评论
?
参与讨论