Hi first time post / ask something here. I am new to powercli and would appreciate some asstiance with the above. To To clarify I would like to;
Read a list of virtual machine names from a .txt file OR possibly a .csv (as i attempted below) file into an Arrary.
I made an attempt with the following that failed
$vms = @()
for (i$ in (import-csv vmlist.csv)) {$vms += get-vm -name i$}
Example Text File.
virtualMachine1
virtualMachine2
virtualMachine3
Welcome to the Communities..
Check if this post helps http://communities.vmware.com/thread/315193
Thank you, but that is not quite what I am after. To clarify I am not attempting to create VMs. The VMs in my text file exist in my VC environment. The text file is a dump of computer obects from a AD group. I just need to create an array of thoes machines from the text file. Once I have an array, something like $vms = get-VM * I can iterate over the arrary to update some custome attributes. Thanks
Ok, took a good look at import.csv and made the following changes to resolution.
Thew out .txt file and went with .csv
Added Colume Heading "Name" and below this added the following VM names
virtualmachine1
virtualmachine2
virtualmachine3
for (i$ in (import-csv vmlist.csv)) {$vms = get-vm -name $i.Name}
Rather simple
Discusion moved from VMware vCenter™ to VMware vSphere™ PowerCLI.