VMware

This Question is Answered

1 "helpful" answer available (6 pts)
1 2 Previous Next 17 Replies Last post: Nov 20, 2009 1:31 AM by LucD  

set-oscustomizationspec and IP address posted: Mar 3, 2008 6:12 AM

Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005

In the set-oscustomizationspec cmdlet there don't seem to be options to customize network related parameters (for example the IP address).

In the "Customization Specification Manager" in the VI Client these customization parameters can be configured.

Is this correct ? Or are we missing something ?


Re: set-oscustomizationspec and IP address

1. Mar 3, 2008 9:09 AM in response to: LucD
Click to view adias's profile Enthusiast 43 posts since
Jan 9, 2008

I think we need to look at this interface again - it's less than intuitive. It looks like to set the IP address, you set the customization spec's NamingPrefix to the address you want and set the NamingScheme to NamingScheme.Fixed.


Re: set-oscustomizationspec and IP address

3. Mar 3, 2008 11:55 PM in response to: LucD
Click to view adias's profile Enthusiast 43 posts since
Jan 9, 2008
Seems like it's probably a bug. We'll have someone look into it.

Re: set-oscustomizationspec and IP address

4. Apr 11, 2008 2:45 PM in response to: adias
Click to view ITworksHH's profile Novice 8 posts since
May 23, 2006
Hello,

anything new to this thread? I would like to do the same for a mass deployment of servers.

Thanks,

Lars

Re: set-oscustomizationspec and IP address

5. Apr 19, 2008 5:50 AM in response to: ITworksHH
Click to view stephen.ng's profile Novice 12 posts since
Apr 4, 2008

Hello, has there been any progress on this? I've been looking through the customization spec object and can't find anything related to IP addresses either--I would expect a NIC setting of some sort.

Thanks,

Steve

Re: set-oscustomizationspec and IP address

7. Apr 20, 2008 5:15 AM in response to: LucD
Click to view ITworksHH's profile Novice 8 posts since
May 23, 2006

Hi,

that's really nice. I will have a look at it. Seems to solve my problem, too.

Many many thanks!
LS

Re: set-oscustomizationspec and IP address

8. Apr 20, 2008 5:18 AM in response to: stephen.ng
Click to view ITworksHH's profile Novice 8 posts since
May 23, 2006

Hi Steve,

I have written an email to adias@vmware.com on Friday. Perhaps we will get an information starting this week.
But have a look at the solution of LucD - seems to solve the problem for me.

LS

Re: set-oscustomizationspec and IP address

9. Apr 21, 2008 10:27 AM in response to: ITworksHH
Click to view c_shanklin's profile Master 754 posts since
Dec 3, 2007
ITworksHH wrote:
Hi Steve,

I have written an email to mailto:adias@vmware.com on Friday. Perhaps we will get an information starting this week.
But have a look at the solution of LucD - seems to solve the problem for me.

We have a bug in the Beta toolkit that we plan to address for GA. In the meantime, using LucD's approach will work very well. When we have fixed our OSCustomizationSpec cmdlets, LucD's approach will still work, but the cmdlets should make it easier.

Re: set-oscustomizationspec and IP address

10. Apr 22, 2008 9:37 PM in response to: c_shanklin
Click to view stephen.ng's profile Novice 12 posts since
Apr 4, 2008

Thanks! That's a big help.

One thing I am still having some trouble with is the resource pool for the target guest OS--I'm not using resource pools at all and would like to deploy the target VM directly on the host. How to get a resource pool object given a host name?

Seems like a simple problem but I have been bashing my head against it for a few hours already.

Thanks,

Steve

Re: set-oscustomizationspec and IP address

12. Apr 23, 2008 2:44 AM in response to: stephen.ng
Click to view stm_cro's profile Novice 16 posts since
Mar 28, 2007
Hello Stephen,

I ran into the same problem.
Ressourcepool is a property of ComputeResource object.
I don't know how you get the parent object so you can reach COmputeResource object with the Find-EntityViews command

With the following line you can make the link between a host and its resource pool (I only look at the first computeResource / host/ resource pool, you need to add loop to scan for your host!)

$cr=Find-EntityViews computeResource
$computeresource0=$cr[0] #here you get the first computeResource object
$host0_ref=$computeresource0.Host[0] #get the first host referenced
$vmhost_obj=get-view $host0_ref
$vmhost_name= $vmhost_obj.name #here you get your host name, now get the ressource pool
$respool_ref=$computeresource0.ResourcePool #here you get a reference
$respool_obj=Get-View $respool_ref #this is the object you can use with a commandlet

I'm just learning...

Re: set-oscustomizationspec and IP address

13. Apr 23, 2008 11:04 AM in response to: LucD
Click to view stephen.ng's profile Novice 12 posts since
Apr 4, 2008
Thanks LucD for your reply.

I think Location.Pool must be set if I am cloning from a template (which is my case):

http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.vm.RelocateSpec.html
For a clone from a template to a virtual machine is argument is required.

So I guess I will have to hunt around for the resource after all....

Steve

Re: set-oscustomizationspec and IP address

14. Apr 25, 2008 3:45 PM in response to: stm_cro
Click to view stephen.ng's profile Novice 12 posts since
Apr 4, 2008
Thanks! That did the trick.

The code I finally wound up using is:

$filter = New-Object -TypeName "System.Collections.Specialized.NameValueCollection"
$filter.Add("Name", $Hostname)
$ComputeResource = Find-EntityViews ComputeResource -Filter $filter

$vmclonespec = New-Object VMware.Vim.VirtualMachineCloneSpec
$vmclonespec.location = New-Object VMware.Vim.VirtualMachineRelocateSpec

$vmclonespec.Location.Pool = $ComputeResource.ResourcePool
$vmclonespec.Location.Host = (Get-View (Get-vmHost $Hostname).id).moref
$vmclonespec.Location.Datastore = (Get-View (Get-Datastore -VMHost (Get-vmHost $Hostname)).id).moref

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities