Hi All,
I am new to powercli and powershell so pardon if my terminology isn't correct. At this point I can really only modify scripts to work in my environment and that is what am attempting here.
I am trying to deploy a number of VMs with all required VM information contained in a CSV.
The script is below attached.
The error I receive is this.
Get-VMHost : Cannot validate argument on parameter 'Name'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again.
I think am failing to pass the variable correctly here it is in the script
$VMHost = Get-VMHost $vm.host
But when I read in the CSV data using the Import-CSV cmdlet I get
Import-CSV Y:\file.csv
VMname : CEIVIRPAS0158
VMhost : ceiatlpvs0004.mgmt.int
datastore : CEIVSC0002_EATL0NET03_LUN3
template : W2008R2_SP1_EE_TEMPLATE
customization : CEI 2008
ipaddress : 10.211.80.142
subnetmask : 255.255.255.0
defaultgw : 10.211.80.1
dns1 : 10.211.68.50
dns2 : 10.211.68.49
disktype : Flat
storageformat : Thin2GB
capacityKB : 20971520
Description : RTIP Administration Web Server 9 of 10
any insight would be very help, thanks!
You sure you are using the right header names from the CSV file? The error message seems to indicate that $vm.host is a $null value.
Your import seems to indicate that the values should be $vm.VMhost. Unless I'm reading something wrong. Same goes for the $VMName variable. You have it set to $vm.name, but the import has it listed as $vm.VMname.
--j
You sure you are using the right header names from the CSV file? The error message seems to indicate that $vm.host is a $null value.
Your import seems to indicate that the values should be $vm.VMhost. Unless I'm reading something wrong. Same goes for the $VMName variable. You have it set to $vm.name, but the import has it listed as $vm.VMname.
--j
After reading your reply that was exactly the issue
THANKS A TON!
No problem. Glad to assist.