Solved

New VM Power CLI

Posted on 2014-04-03
3
1,042 Views
Last Modified: 2014-04-08
Hi Guys,

I am trying to create new vm's using this script and for some reason it does not work

$dsc=Get-Datastore DC1_A_T1_SRM_PL006
$tmp=Get-Template -name *win*2008*r2*ent
$name= "DEV-SQL-DBA-01"

New-VM -Name "$name" -Template "$tmp" -Datastore "$dsc" -Memorygb "8" -NumCPU "4" -Networkname DB_SQL_2264 -Notes "Request 12099 - Adam Hobden " -DiskGB 250,50,100,100

Open in new window


it gives me the error message :


New-VM : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ New-VM -Name "$name" -Template $tmp -Datastore $dsc -Memorygb 8 -NumCPU 4 -Netwo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-VM], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

Please help!
0
Comment
Question by:Kay
  • 2
3 Comments
 
LVL 25

Expert Comment

by:Zephyr ICT
ID: 39974644
I think you're mixing parameters that are not allowed.

If you want to use the parameter "-Template" you probably cannot use the parameter "-MemoryGB" ...

Check this by running "Get-Help New-VM"  then check in which of the 4 (I think it's four, it used to be :) ) New-VM sections, the parameter "-Template" can be found and make sure all your other parameters are in there.

You'll probably need to set your memory/cpu parameters after the VM is created.
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 39974649
Try this:   there is no parameter with GB but MB
secondly, diskmb should be a numeric value  you gave array as the value?
#-----------------------------------
$dsc=Get-Datastore DC1_A_T1_SRM_PL006
$tmp=Get-Template -name *win*2008*r2*ent
$name= "DEV-SQL-DBA-01"

New-VM -Name "$name" -Template "$tmp" -Datastore "$dsc" -Memorymb "8000" -NumCPU "4" -Networkname DB_SQL_2264 -Notes "Request 12099 - Adam Hobden " -DiskMB 250
0
 
LVL 25

Accepted Solution

by:
Zephyr ICT earned 500 total points
ID: 39974654
There is a parameter "memorygb" in PowerCLI version 5.1, it can be found here for reference: https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/New-VM.html
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

David Varnum recently wrote up his impressions of PRTG, based on a presentation by my colleague Christian at Tech Field Day at VMworld in Barcelona. Thanks David, for your detailed and honest evaluation!
Will try to explain how to use the VMware feature TAGs in the VMs and create Veeam Backup Jobs using TAGs. Since this article is too long, I will create second article for the Veeam tasks.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now