4
我試圖將兩個性能計數器的數值僅導出到CSV。我已經能夠一起建立一些東西,但我仍然需要一些幫助。Powershell - 導出爲CSV問題
$counter1 = "\\ygex01wal\SMTP Server(_total)\Messages Received Total" $counter2 = "\\ygex01wal\SMTP Server(_total)\Messages Sent Total" $data1 = Get-Counter $counter1 $data1cooked = $data1.countersamples | Select-Object cookedvalue $data2 = Get-Counter $counter2 $data2cooked = $data2.countersamples | Select-Object cookedvalue $object = New-Object PSObject add-member -InputObject $object Noteproperty 'Received' $data1cooked add-member -InputObject $object Noteproperty 'Sent' $data2cooked $object | Export-Csv c:\csv.csv -NoTypeInformation
我的CSV最終看起來像:
"Received","Sent" "@{CookedValue=2469610}","@{CookedValue=307718}"
我寧願它看起來像
"Received","Sent" "2469610","307718"
我如何能到達那裏有什麼建議?