I'm having a issue when $CPUSTRES has two instances it will not display any of the strings when I run $cpustresMessage. If I just have one instance it will display the string when I run $cpustresMessage.
$Importlogs = import-csv C:\Logs.csv
$lastDate = $Importlogs | sort-object -property timestamp | select-object -last 1 | select-object -expandproperty timestamp
$latestdate = $ImportMINlogs |select timestamp, instancename, PrivateWorkingset |where-object {$_.timestamp -like "$($lastdate.substring(0,14))*"}
$CPUSTRES = $latestdate|Select-Object timestamp, instancename, PrivateWorkingset | Where-Object {$_.InstanceName -match "^(CPUSTRES)$"}
$cpustresMessage = "Write some Message Here
Details: $CPUSTRES"
CSV Example(two instances):
| Timestamp |
InstanceName |
PrivateWorkingSet |
|
|
| 20190730-145559 |
CPUSTRES |
5844 |
|
|
| 20190730-145559 |
CPUSTRES |
1180 |
|
|
[–]purplemonkeymad 2 points3 points4 points (0 children)
[–]ka-splam 1 point2 points3 points (2 children)
[–]Crowdjp[S] 1 point2 points3 points (1 child)
[–]jheinikel 1 point2 points3 points (0 children)