Export-Csv -Path C:\temp\software1.csv Note: I need health check , ...

问题描述 投票:0回答:1
Generally speaking, when you run a powershell command it only shows what sections are deemed as important. If you take the same command and pipe it to format-list (or "ft" for short) you will get everything.

When exporting it exports everything.Also, you need to add the paramater -NoTypeInformation to get rid of the first row.

#Disk Space
Get-Volume
$results = Get-Volume | Export-Csv -Path C:\temp\software1.csv

To only get certain values, you will just pipe it using select.. something like this:

Also, there is no need to do $results = get-volume... This pushes the output into the variable $results. This would be applicable if you wanted to recall the variable later. So, you could also do something like this..

excel powershell export customization
1个回答
0
投票

先谢谢朋友们:)

Get-Volume | ft

Get-Volume | select HealthStatus, DriveLetter, SizeRemaining,DriveType | Export-Csv -NoTypeInformation -Path C:\temp\software1.csv

我用了下面的,它给出了一些不同的excel,请帮我这个#Disk Space Get-Volume $results = Get-Volume。

© www.soinside.com 2019 - 2024. All rights reserved.