When I run this now, I receive the following error message for each entry in my CSV file. The CSV file has one column that says Name, and then the list of all the servers underneath of it. I replaced my actual servername with ServerName in the error code below.
Get-VM : 2/13/2013 1:17:33 PM Get-VM VM with name '@{Name=ServerName}' was not found using the specified filter(s).
At line:12 char:1
+ Get-VM (Import-CSV C:\VMList.csv) | Select Name,BIOSNumber
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
+ FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM
EDIT:
I think something weird is going on. If I remove the name field from the CSV, I get the following error. ServerName1 is the first entry listed in the .CSV. ServerNameX is any other server in the list. So it's going through all 250 of them and throwing an error for every single server, with ServerName1.
Get-VM : 2/13/2013 1:27:09 PM Get-VM VM with name '@{ServerName1=ServerNameX}' was not found using the specified filter(s).
At line:1 char:1
+ Get-VM (Import-CSV C:\VMList.csv) | Select Name,BIOSNumber
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
+ FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM
All the code before the line below completes without error if I paste it into PowerCli.
Get-VM (Import-CSV C:\VMList.csv) | Select Name,BIOSNumber