Ergebnis von foreach-schleife in .csv Datei exportieren
Hallo,
habe folgendes Problem..kenne mich noch recht wenig mit Powershell aus, habe aber zumindest schonmal eine Konsolenausgabe hinbekommen, die mir CPU ID, Anzahl Kerne etc. anzeigt.
$strComputer = "."
$colItems = Get-WmiObject -class "Win32_Processor" -namespace "root/CIMV2" -computername $strComputer
foreach ($objItem in $colItems)
{
write-host "CPU ID: " -foregroundcolor yellow -NoNewLine
write-host $objItem.DeviceID -foregroundcolor white
write-host "CPU Model: " -foregroundcolor yellow -NoNewLine
write-host $objItem.Name -foregroundcolor white
write-host "CPU Cores: " -foregroundcolor yellow -NoNewLine
write-host $objItem.NumberOfCores -foregroundcolor white
write-host "CPU Max Speed: " -foregroundcolor yellow -NoNewLine
write-host $objItem.MaxClockSpeed
write-host "CPU Status: " -foregroundcolor yellow -NoNewLine
write-host $objItem.Status
}
Nun will ich dieses Ergebnis aber als CSV exportieren und weiß nicht wie.
Danke für eure Hilfe,
Ratmin193
habe folgendes Problem..kenne mich noch recht wenig mit Powershell aus, habe aber zumindest schonmal eine Konsolenausgabe hinbekommen, die mir CPU ID, Anzahl Kerne etc. anzeigt.
$strComputer = "."
$colItems = Get-WmiObject -class "Win32_Processor" -namespace "root/CIMV2" -computername $strComputer
foreach ($objItem in $colItems)
{
write-host "CPU ID: " -foregroundcolor yellow -NoNewLine
write-host $objItem.DeviceID -foregroundcolor white
write-host "CPU Model: " -foregroundcolor yellow -NoNewLine
write-host $objItem.Name -foregroundcolor white
write-host "CPU Cores: " -foregroundcolor yellow -NoNewLine
write-host $objItem.NumberOfCores -foregroundcolor white
write-host "CPU Max Speed: " -foregroundcolor yellow -NoNewLine
write-host $objItem.MaxClockSpeed
write-host "CPU Status: " -foregroundcolor yellow -NoNewLine
write-host $objItem.Status
}
Nun will ich dieses Ergebnis aber als CSV exportieren und weiß nicht wie.
Danke für eure Hilfe,
Ratmin193
Please also mark the comments that contributed to the solution of the article
Content-Key: 202063
Url: https://administrator.de/contentid/202063
Printed on: April 26, 2024 at 08:04 o'clock
3 Comments
Latest comment
Hi,
ich kenne mich auch kaum bis gar nicht mit Powershell aus, aber ich habe schon mal vom Befehl Export-CSV gehört.
http://technet.microsoft.com/de-de/library/ee176825.aspx
Bringt dir das was?
Gruß
ich kenne mich auch kaum bis gar nicht mit Powershell aus, aber ich habe schon mal vom Befehl Export-CSV gehört.
http://technet.microsoft.com/de-de/library/ee176825.aspx
Bringt dir das was?
Gruß