VMware Cloud Community
gpeck29
Enthusiast
Enthusiast
Jump to solution

Help Please...Create New VM from Template

I'm new to both Powershell and the VMware VI toolkit, but I wanted to create a new VM froma template.

I have a template "XP Professional" that requires me to enter an IP address for the template, I also want to put this ina folder called "XP Workstations". I want to control what datastore is used as well, e.g. datastore1. I've tried several times to figure this out, but with no success.

Would somebody like to enlighten me.

Also, something weird happens....When I conenct to VC (Get-VC <VCServerName>) I connect to the VC, but I am NEVER prompted for my credentials. I can read VC fine, but even a simple "new-vm" command fails.

greg

0 Kudos
1 Solution

Accepted Solutions
halr9000
Commander
Commander
Jump to solution

There actually is a way to specify the IP address, but it's hard, and there's a bug in that code at present. VMware has acknowledged both issues in this thread:

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000

View solution in original post

0 Kudos
3 Replies
admin
Immortal
Immortal
Jump to solution

Hi,

New-VM accepts "Template" as parameter and you can specify the folder in which to put the new VM. But there is no way to specify the IP of the machine.

So what you can do currently is:

Get-Template "XP Professional" | New-VM -VMHost "host name" -Name "vm name" -Location ( Get-Folder "XP Workstations" ) -Datastore ( Get-Datastore "datastore1" )

As for the Get-VC problem - there is a separate topic in the forum for this: http://communities.vmware.com/thread/133717

halr9000
Commander
Commander
Jump to solution

There actually is a way to specify the IP address, but it's hard, and there's a bug in that code at present. VMware has acknowledged both issues in this thread:

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
admin
Immortal
Immortal
Jump to solution

Also, something weird happens....When I conenct to VC (Get-VC <VCServerName>) I connect to the VC, but I am NEVER prompted for my credentials. I can read VC fine, but even a simple "new-vm" command fails.

greg

The VI Toolkit will take advantage of SSPI if you have it configured in your environment. Is it possible that this is what happens? When you connect to VC, are you able to run the get-vmhost cmdlet successfully?

0 Kudos