I have two Powershell scrips below and they do different things but I need them to do roughly similar things when they export to CSV.
Get-ChildItem C:\Users\user\Desktop\here -Recurse |
where {!$_.PSIsContainer} |
Select-Object * |
Export-Csv -NoTypeInformation -Path C:\Users\user\Desktop\Output\output.csv |
% {$_.Replace('"','')}
Gets me all the detailed info about a directory and when I open the CSV in Excel everything is in separate columns - Perfect.
plink.exe -ssh root@user -pw password -m C:\Users\user\Desktop\Scrips\LinuxScriptCommand.txt > C:\Users\user\Desktop\Output\Linux.csv
Runs df -h on my cloud and returns the space left on my drives, which is what I want, but when I open this CSV in Excel it makes me go through the text import wizard which the other doesn't.
I can't figure out a way to automate the text wizard part, can anyone provide me some insight? Also if you have a way to optimize it please let me know too.
plink.execommand (ultimately) runsdf -h, the result will not be a CSV file - instead, you'll get whitespace-separated columns.| Select-Object *serves no obvious purpose and neither does| % {$_.Replace('"','')}, given thatExport-Csvproduces no output (except writing to a file) and therefore sends nothing through the pipeline.plinkis running the command(s) on.