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
Solved

New VM Power CLI

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article, I will show you HOW TO: Create your first Windows Virtual Machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, the Windows OS we will install is Windows Server 2016.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
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…
The viewer will learn how to dynamically set the form action using jQuery.

860 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