This topic contains 5 replies, has 3 voices, and was last updated by
Standard Aliases for Import-CSV: ipcsv The ConvertTo-CSV and ConvertFrom-CSV cmdlets can also be used to convert objects to CSV strings (and back). These cmdlets are the same as the Export-Csv and Import-CSV cmdlets, except that they do not save the CSV strings in a file. Aug 10, 2017 - Here is the structure of my dupelog.csv: COMPUTERNAME,USERNAME,PRINTERNAME RUN5V3N502B,kvanmeeteren,RUNM7V-RAMS1.
Kevyn
![Csv Csv](/uploads/1/2/5/7/125734916/195167612.png)
![Csv Csv](/uploads/1/2/5/7/125734916/164312394.jpg)
- Oy, Write-Host. Sigh. The struggle is real. I might humbly suggest you look into Write-Verbose and Write-Debug as more sustainable ways to do what you're doing ;).So, I'd obviously question what was in $computerName, $userName, and $printerName when you run this. For example, based on your sample data:Does that return anything?
- I see my post was too late, but here's other ways to debug a script when you run into something like this in the future:In addition to Write-Debug, you might try debugging your script by setting up a PS breakpoint for the $ComputerName, $UserName, & $PrinterName variables to follow their values as the script runs. When you hit a breakpoint, it will tell you which variable it broke for, and whether it was a read or a write operation. For each time it breaks, you can manually dump out the variable. You might even put a Write-Debug statement before it breaks on reading the variables for the importing of the importing of the failures.csv file to say something like 'About to import the failures.csv.'. That way, you can see what the value of each variable is when the import of the failures.csv is being done.Set-PSBreakpoint -Script -Variable ComputerName,UserName,PrinterName -Mode ReadWrite
- Corrected the Set-PSBreakPoint command for my earlier post.
The topic ‘Can't get Where-Object to work on Imported CSV’ is closed to new replies.