VMware {code} Community
peterc4270
Contributor
Contributor

VI perl toolkit: can you use a customization specification with vmclone.pl

I'd like to clone a VM from a template and apply an existing customization specification (created in VC).

Anyone have any ideas on how to specify this in the xml specifications or via the perl script?

Thanks!

Reply
0 Kudos
28 Replies
jnhall
Enthusiast
Enthusiast

That's an easy one. Because commandList is a string array, you need to provide a reference to an array of arguments.

Because of the brackets this is probably going to get mangled ...

commandList => [ "c:\setup\some.cmd" ]

or

commandList => [ "c:\setup\some.cmd", "c:\setup\another.cmd" ] ...

and so on.

(Checks.) Yes it was mangled. That should read in part

left-bracket double-quote c colon backslash .... double-quote right-bracket

-joseph

Reply
0 Kudos
tbrouwer
Hot Shot
Hot Shot

Where do you specify what the Administrator account password should be?

When I clone a VM, it boots up and hangs at the administrator password screen and requires user intervention to click "next".

How can I avoid this? The rest of the clone/sysprep process works fine, I just cant figure out how to pass the administrator password.

Thanks!

Reply
0 Kudos
peterc4270
Contributor
Contributor

Hello,

We have got past this point OK.

It was a matter of getting the correct object and having a blank password set in the template (windows 2003 server).

Many thanks.

Reply
0 Kudos
tbrouwer
Hot Shot
Hot Shot

I have my admin password blank on the template, and I've added entries into VMUtil.pm, but it STILL hangs up at that spot asking what the admin password should be.

If I could get it to just keep the admin password that the template has I would be happy, but I cant even get that to work

Reply
0 Kudos
peterc4270
Contributor
Contributor

Hello,

We switched our attention to the vmprovsion.pl script, which can be found in samples\vm

In there, we use a password variable:

userpassword => {

type => "=s",

help => "Password of the target vm",

required => 0,

default => "********",

},

and then in the clone_relocate_vm routine:

my $pwd = Opts::get_option('userpassword');

my $vmdest = Opts::get_option('vmname_destination');

my $customization_global_settings = CustomizationGlobalIPSettings->new();

my $customization_identity_settings = CustomizationIdentitySettings->new();

my $password =

CustomizationPassword->new(plainText=>"true", value=> $pwd );

my $cust_identification =

CustomizationIdentification->new(joinWorkgroup => "MANPCGROUP");

my $cust_gui_unattended =

CustomizationGuiUnattended->new(autoLogon => "true",

autoLogonCount => 1,

password => $password,

timeZone => 35);

We run some post-clone routines, so you may wish to set the autoLogon to false.

My Perl isn't that great, so you'll likely see some opportunities to make it more efficient.

Hope this helps.

Cheers

Reply
0 Kudos
tbrouwer
Hot Shot
Hot Shot

Thank you! I got it working now. Now I just have to get the run once to trigger and I'll be all set!

Reply
0 Kudos
jnhall
Enthusiast
Enthusiast

I am really psyched that you have gotten what is a pretty complex and ungainly process to work via Perl Toolkit. Hopefully at some point in the foreseeable future we can figure out how to document this better and maybe provide an example, although it would be difficult to provide a generic program or app to support this type of provisioning. (At least that's my thinking at the moment.)

Reply
0 Kudos
peterc4270
Contributor
Contributor

Hello,

We've had plenty of help and a couple of lucky guesses ;-).

However, we're pleased with the results so far.

To give it a little more context, we're putting a 'self-service' system in place, which allows users to get virtual resources without the need to be granted access to VC or make formal requests to the system administrators.

We're certainly happy if any of the VMware community find it useful.

Cheers.

Reply
0 Kudos
Carmageddon
Contributor
Contributor

Peter, Just found your post and been reading information last 3 hours on the topic of changing password while cloning a VM (either linux or windows based)

Seems still poorly (not at all) documented even now 3 years later Smiley Sad

I would still like to see your script, my guess is that it should at least work for the Server 2003 and (hopefully) 2008, leaving me with only linux root password change issue, so would be there half way.

I cant find your script in the sample Perl scripts folder.

Can you (or anyone) link or upload please?

Thanks!

Reply
0 Kudos