I'm having a heck of a time trying to import a CSV and run a Invoke-WebRequest to get data to add to a new Column..
$username = "Username"
$password = cat C:\Password.txt | convertto-securestring
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$csv = Import-Csv -Path C:\users\Desktop\ImportTest.csv
foreach($c in $csv){
$link = "https://MyURlToCallforData"
$uri= $link + $c.stuff
Invoke-WebRequest -Uri $uri -Credential $cred -UseBasicParsing| ConvertFrom-Json | Select-Object -Property lastIdReportTime
}
Export-Csv -Path C:\Users\Desktop\TestOutput.csv -NoTypeInformation
No i can import it fine, I make the call and i see the results on the ISE but I can't export to a CSV or append the current File.
I've tried all sorts of things, trying to add a new content trying to add a psObject and whatever I do i fail at..
Hoping someone can give me a hand here.
The CSV is basically like this.
Date,Description
Text1,text2
text3,text4
and i want to export it like this
Date,Description,NewInfo
Text1,text2,new5
text3,text4,new6