Solved

New VM Power CLI

Posted on 2014-04-03
3
1,154 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 19

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Advanced tutorial on how to run the esxtop command to capture a batch file in csv format in order to export the file and use it for performance analysis. He demonstrates how to download the file using a vSphere web client (or vSphere client) and exp…
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

679 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