Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

New VM Power CLI

Posted on 2014-04-03
3
Medium Priority
?
1,318 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 2000 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

Ready for your healthcare security check-up?

In the past few years, healthcare organizations have become a prime target for advanced attacks. Does your organization have what it needs to defend itself? Schedule your healthcare security check-up today and download our free Healthcare Security Resource Kit today!

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
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…
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…
Suggested Courses

972 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