I am fairly new to scripting so this may be a little vague or poorly worded. I also cut some stuff out, it is irrelevant, just names, but this is for someone else so in case they don't want it out there better safe than sorry. ANYWAY
I have a script to run a simple test against my system using another .exe that outputs a CSV file of the result when it is finished. I have it using a stream reader to read the output from the CSV file when I run it and erase the CSV it is running from at the end of the test. I am trying to tweak it to create a new file when a test is run that is titled "date-time.txt" and output that specific test into the time-stamped .txt file
Here is what I have so far, I am not sure if it is easier to piggyback off this code or make a separate function.
code to stream read tests and format
I have tried the following code someone suggested:
enter code here
$FileName = (Get-Date -Format "yyMMdd-HHmmss") + ".txt"
$File = New-Item -Type File -Path "." -Name $FileName
$stream_reader = New-Object System.IO.StreamReader{$File.FullName}
This creates the file but I cannot figure out where I should put it in my code and the proper way to get the content of the audit.csv into the new file and not disrupt the test.