madeline-s
6/15/2017 - 5:19 PM

VCS-Juan-PS

VCS-Juan-PS

$date =  Get-Date
$endfile = $date.ToString("hhmmssddMMyy")
$endfile

function Generate_New_File()
{

$CSV = Import-Csv "\\team.volusia.k12.fl.us\technology-services\copy-center\Shared Documents\Toshiba Invoice Maintenance.csv" -Delimiter ","
$NewCSV = 0
$NewCSV = @()
for ($i=0;$i -lt $CSV.Count; $i++)
{ 
   $ObjectCreate = New-Object system.object
   $ObjectCreate | Add-Member -MemberType NoteProperty -Name "ID#" -Value $CSV[$i]."ID#" 
   $ObjectCreate | Add-Member -MemberType NoteProperty -Name "Serial #" -Value $CSV[$i]."Serial #"
   $ObjectCreate | Add-Member -MemberType NoteProperty -Name "Invoice Date" -Value $CSV[$i]."Invoice Date"
   $ObjectCreate | Add-Member -MemberType NoteProperty -Name "Invoice Number" -Value $CSV[$i]."Invoice Number"
   $ObjectCreate | Add-Member -MemberType NoteProperty -Name "Total Charge" -Value ($CSV[$i]."Total Maintenance Charge").trim()
   $NewCSV += $ObjectCreate
 }

$NewCSV | Export-Csv -NoTypeInformation -Path "\\team.volusia.k12.fl.us\technology-services\copy-center\Shared Documents\Automation test\ToshibaImportFile.CSV"


}

#Main

if (Test-Path("\\team.volusia.k12.fl.us\technology-services\copy-center\Shared Documents\Toshiba Invoice Maintenance.csv"))
{
"we made it here" 
&Generate_New_File
}