Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

Clone script problem - New-VM : Parameter set cannot be resolved using the specified named parameters.

$
0
0

Hello. First time post, so please be kind. Running into hella errors trying various methods to run this script:

 

$cloneparams = "c:\scripts\clone-parameters.csv"

 

import-csv $cloneparams -useculture | %{

 

get-oscustomizationspec $_."customization" | get-oscustomizationnicmapping |`

set-oscustomizationnicmapping -ipmode UseStaticIp -ipaddress $_.ip -subnetmask $_.subnetmask -defaultgateway $_.gateway

 

new-vm -vmhost $_."vmhost" -name $_."vm_name" -location $_."folder" -template $_."template_name" -resourcepool $_."resource_pool" -datastore $_."datastore_name" -numcpu $_."numcpu" -memorymb $_."memoryMB" -oscustomizationspec $_.customization -confirm:$false -runasync

 

}

 

The error looks like this:

 

New-VM : Parameter set cannot be resolved using the specified named parameters.

At C:\scripts\clonescript.ps1:14 char:7

+ new-vm <<<<  -vmhost $_."vmhost" -name $_."nameyname" -location $_."folder" -template $_."template_name" -resourcepool $_."resource_pool" -datastore $_."datastore_name" -numcpu $_."numcpu" -memorymb $_."memoryMB" -oscustomizationspec $_.customization -confirm:$false -runasync

    + CategoryInfo          : InvalidArgument: (:) [New-VM], ParameterBindingException

    + FullyQualifiedErrorId : AmbiguousParameterSet,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

 

The .csv has these column headers (with appropriate values under each for a bunch of new VMs to be created):

 

vm_nametemplate_namedatastore_namecustomizationvlanipgatewaysubnetmaskdnsfolderresource_poolnumcpumemoryMBvmhost

 

The oscustomizationspec bit seems to be working, but the New-VM commandlet is obviously not happy.

 

I have seen that others have posted similar code that seems to be working for them. Any thoughts highly appreciated.

 

Thanks!


Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>