Add-PSSnapin VMware.VimAutomation.Core
connect-viserver -server Vcenterserver
Add-PSSnapin VMware.VimAutomation.Core
Function VM-Selection {
$vms = @()
Import-Csv C:\VMware\Annotations.csv |
%{$vms += (Get-VM $_.VM | Set-Annotation -customattribute $_.Annotation -Value $_.Value)
}
return $vms
}
VM-Selection
Disconnect-VIServer -Confirm:$false
csv: VM,Annotation,Value
all virtual machines name,annotations and Value are correct in csv file
Wenever im using the script, Im getting the below error, Please help me out.
Im having issues to import from csv file. watever modules i use for annotations im having issues in importing ALL THE VALUES values from csv file
Please let me know how to resolve this
Get-VM : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not
null or empty, and then try the command again.
At line:8 char:26
+ %{$vms += (Get-VM $_.VM | Set-Annotation -customattribute $_.A ...
+ ~~~~~
+ CategoryInfo : InvalidData: (:) [Get-VM], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM