Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to export data to multiple csv files?

$
0
0

Hey Scripting Guys,

As stated by the name I'm a novice at scripting.  Typically I'm able to resolve most of my scripting challenges by reading through your site or scouring the internet.  This challenge I haven't been able to resolve.  Please help!!

I'm running a script (posted below) to grab data and export it to a csv file.  My challenge is that I want to run the script daily via task manager and have it create a new csv file either daily or weekly.  I'm having trouble with the scripting creating a new csv file.  How do I resolve this?  

It would be beneficial to append the date to a standard file name, ex. c:\exportedcsv7-11-2014.csv; the next day it would be c:\exportedcsv7-12-2014.csv; and so on.

Thank you in advance to any assistance.

Respectfully,

ScriptingNovice

Get-Datastore -Name "*DS*" | Sort $_.name | Get-View | Select -ExpandProperty Summary | `

Select Name,
@{N=”FreeSpaceGB”;E={[Math]::Round($_.FreeSpace/1GB,2)}},
@{N=”CapacityGB”; E={[Math]::Round($_.Capacity/1GB,2)}},
@{N=”UncommittedGB”; E={[Math]::Round($_.Uncommitted/1GB,2)}},
@{N=”ProvisionedGB”;E={[Math]::Round(($_.Capacity – $_.FreeSpace + $_.Uncommitted)/1GB,2)}},
@{N=”Over-Provisioned-DS”;E={([Math]::Round($_.Capacity/1GB,2)) – ([Math]::Round(($_.Capacity – $_.FreeSpace + $_.Uncommitted)/1GB,2))}}| `

select Name,CapacityGB,FreespaceGB,ProvisionedGB,UncommittedGB,Over-Provisioned-DS | export-csv -notype c:\vmds.csv




Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>