VMware {code} Community
Chinmay_Shepal
Contributor
Contributor

Assign IP address to VM

Hi All,

I am new to this community.

What I am trying to do is :

1. Clone our one of the existing VM using vmclone.pl

2. I am mounting an ISO image to it using vmISOManagement.pl (http://communities.vmware.com/servlet/JiveServlet/download/11003-1-30589/vmISOManagement.pl)

3. I am powering on the VM using powerOnVm.pl.

Here I am facing challenge is like, I need to assign username, password,management IP, netmask and gateway. Is there any solution to do these activities using the VI perl sdk?

Reply
0 Kudos
4 Replies
wenxin1234114
Contributor
Contributor

you searched bbs ,it has .

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

Yes, that's all possible with the vSphere SDK (and VI Perl).  There may not be an existing script that does exactly what you want and it might have to be created or modified.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
Chinmay_Shepal
Contributor
Contributor

I can get the console of VM by passing parameters (hostname,ip,username and password.

But the VM I am mentioning here needs to set an IP address,password etc after we boot it with the ISO image of our product. So is there any way that I can get the VM console or handle by just passing the VM name?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

If you have VMware Tools installed on the VM and are on vSphere 5.0 or later, you can use the GuestOperations object in the API to run scripts and programs in the GuestOS without network connectivity:

http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.vm.guest.Gues...

You do still need credentials in the GuestOS (no one wants to have their GuestOS security bypassed!).  But usually the simplest approach is to create a service account in your template image, use that for the GuestOperations calls.  Then if you can optionally to delete that account in your scripts/programs.

You can also do a lot of those settings during the clone operation with a reconfiguration spec.  So depending on your network configuration needs (for example if it's fairly straightforward), then you can configure it during the cloning operation.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos