https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/VM-notes/m-p/2837653#M100569
@LucD , you have given the above script earlier. But when I tried to run the same command I am getting error.
First, it is not importing the csv file. Getting the below error and this is the content in that csv file:
Can you please suggest?
Then I don't immediately understand why you get that error.
Can you try with a new CSV, perhaps with only 1 row.
And then gradually increase the number of rows.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That message typically comes when the column header row has a duplicate.
For one reason or another the Import-Csv cmdlet seems to interpret each row as a header row.
Can you open that CSV file in a text editor (not Excel), and check what is actually in there?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This is what I can see by opening that csv file as a notepad
Then I don't immediately understand why you get that error.
Can you try with a new CSV, perhaps with only 1 row.
And then gradually increase the number of rows.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It worked by saving the file in csv format which is in green circle
Then there were probably some special characters in the file.
You might want to have a look at the original file with something like Notepad++ and enable View Show All Characters
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference