D:\Program Files\VMware\Infrastructure\vSphere PowerCLI> New-
VM -vmHost "140.104.16.139" -Name clonevcuat -VM chdcvvsp8306 -datastore tg_vmfs
uat03 -location vc_clone
New-VM : 09/03/2010 12:02:47 New-VM Could not find VMHost with name '
140.104.16.139'.
At line:1 char:7
+ New-VM <<<< -vmHost "140.104.16.139" -Name clonevcuat -VM chdcvvsp8306 -data
store tg_vmfs_uat_03 -location vc_clone
New-VM : Value cannot be found for the mandatory parameter VMHost
At line:1 char:7
+ New-VM <<<< -vmHost "140.104.16.139" -Name clonevcuat -VM chdcvvsp8306 -data
store tg_vmfs_uat_03 -location vc_clone
The first line of the errors said it couldnt find your host, are you sure you got the name correct ? is it listed if you do a Get-VMHost ?
If you found this information useful, please consider awarding points for Correct or Helpful.
Alan Renouf
You can pass a name to the -VMHost paramter but not an IP address.
Don't you have name resolution ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you have name resoltion you could do
$hostnameRegEx = [regex]"Name:\s+([\w|http://\.]+)" $text = nslookup 140.104.16.139 $hostname = $hostnameRegEx.Match($text).Groups[1].Value New-VM -vmHost $hostname -Name clonevcuat -VM chdcvvsp8306 -datastore tg_vmfs_uat_03 -location vc_clone
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you have DNS name resolution you can also do:
$hostname = \[System.Net.Dns]::GetHostbyAddress("140.104.16.139").HostName New-VM -vmHost $hostname -Name clonevcuat -VM chdcvvsp8306 -datastore tg_vmfs_uat_03 -location vc_clone
Please remove the \ after =. I don't know how to prevent this forum software to insert a link if I don't put the \ there.