VMware Cloud Community
NeenaJim
Enthusiast
Enthusiast
Jump to solution

VM Notes1

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?

NeenaJim_0-1667492867191.pngNeenaJim_1-1667492930208.png

 

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

This is what I can see by opening that csv file as a notepad

NeenaJim_0-1667500163295.png

 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

NeenaJim_0-1667848427093.png

It worked by saving the file in csv format which is in green circle

0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos