Ich habe dieses Skript:Ausgang Reduzieren von drei Befehle einer Zeile
$counterWS = "\Process(powershell)\Working Set"
$counterWSPe = "\Process(powershell)\Working Set Peak"
$counterWSPr = "\Process(powershell)\Working Set - Private"
$dataWS = Get-Counter -Counter $counterWS
$dataWSPe = Get-Counter -Counter $counterWSPe
$dataWSPr = Get-Counter -Counter $counterWSPr
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr Timestamp
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr [-]
while ($true) {
$dataWS.countersamples | Format-Table Timestamp,@{Name='WorkingSet';Expression={($_.CookedValue/1KB)}},WorkingSetPeak,WorkingSetPrivate -Auto | findstr [:]
$dataWSPe.countersamples | Format-Table Timestamp,WorkingSet,@{Name='WorkingSetPeak';Expression={($_.CookedValue/1KB)}},WorkingSetPrivate -Auto | findstr [:]
$dataWSPr.countersamples | Format-Table Timestamp,WorkingSet,WorkingSetPeak,@{Name='WorkingSetPrivate';Expression={($_.CookedValue/1KB)}} -Auto | findstr [:]
Start-Sleep -s $args[0]
}
und das Ergebnis ist wie:
Timestamp WorkingSet WorkingSetPeak WorkingSetPrivate --------- ---------- -------------- ----------------- 29/07/2016 18:41:12 10644 29/07/2016 18:41:13 10676 29/07/2016 18:41:14 3056
Gibt es eine Möglichkeit zu reduzieren, um eine Ausgabe wie diese zu machen:
Timestamp WorkingSet WorkingSetPeak WorkingSetPrivate --------- ---------- -------------- ----------------- 29/07/2016 18:41:12 10644 10676 3056