I have no bloody idea how to make this work, it seems that the 2nd part just executes on my local machine and the $entry in $average doesnt work, or more specifically, there are no $entries just 1 average. Is the logic wrong ?
Not sure how to insert this as “powershell” into the forum
$computers = (gc C:\temp\computers.txt).split(“,”)
$average = invoke-command -computerName $computers -scriptblock {
(Get-Ciminstance Win32_ReliabilityStabilityMetrics |
Measure-Object -Average systemStabilityIndex | select average)}
foreach ($entry in $average){
if ($entry.average -lt 5) {
invoke-command -computerName $computers -scriptblock {get-wmiobject Win32_ReliabilityRecords -property Message |
select-object -first 2 Message | format-list *}
}}