Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

export-csv

$
0
0

I want to check diskspace on our network, and have a problem when i export it to a csv file i only have the last entry from my import file.

is there a way to append the csv file with the next entry?

my script looks like.

import-csv servers1.csv | foreach {

$computername = $_.computername

Get-WmiObject win32_logicaldisk -computername $computername | Where-Object { $_.FreeSpace -lt 1GB } | Select-Object SystemName,DeviceID,VolumeName,FreeSpace,Size | export-csv -path C:\temp\MyDiskSpace.Csv}

and the import file looks like:

computername
SRV1
SRV2
SRV3 

the output only shows the info from SRV3.

I also would like that if the freespace size is higher then 1 gb ik won't show up in the export file.

kind Regards

Alfred


Viewing all articles
Browse latest Browse all 6937

Trending Articles