Solved

New VM Power CLI

Posted on 2014-04-03
3
1,172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ARP not working as expected 11 81
Powershell command to get top 10 process and Memory 5 34
Move Hosts to new cluster 2 60
I'm being stupid with my powershell 2 28
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

752 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