p2v script

ryansoto
ryansoto used Ask the Experts™
on
Hello,

We have vsphere here at work and now I need a P2V script to automate importing physical machines into vcenter.  I have read the notes over and over but I am falling flat on generating the .xml file needed for converter.  We have converter enterprise(the integrated piece in the VIC)
The standard example is close the only extra item is I needed to set the IP information once the conversion is done.  I dont know how to piece all of it together.  If I could get a script where I just have to fill in the blanks that would be great!

I'm not opposed to using some other method of programming other than the .xml but I need a place to put what datastore, host, etc
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Paul SolovyovskySenior IT Advisor
Top Expert 2008

Commented:
Does this need to be a one  time or on a reoccuring scheduled basis?

Author

Commented:
I have an opalis server(basically a big task scheduling server) that will run the script.  
I know that the vsphere client can also schedule  tasks which is great, but we have to use this scheduling server(SOX rules )
The script will be run maybe weekly or every 3-4 days.
Top Expert 2010

Commented:
This question has come up before, with no true available way to do so (unless you've since learned of something Paul). There are just so many variables with this that I don't see how it's possible...IP, sysprep, disk size, resources (CPU, RAM), etc. The best/safest way is either the vSphere Server 'import' (converter) plug-in, or vCenter Converter Standalone tool (https://www.vmware.com/tryvmware/?p=converter&rct=j&sa=X&ei=0QktTMetF6ThnQe8md20Aw&ved=0CBkQqwMoADAA&q=vcenter%20converter&usg=AFQjCNGhJp-UQLiJlP81VQs0SDrrwbjEoQ). I haven't looked into it too much, but maybe you can create a schedule in vCenter? But again, there are so many things to configure as noted above, I'm not sure this can be achieved.

Regards,
~coolsport00
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
There is definately a way to script it and vmware has the tools already you basiclaly use the cli that calls the converter app.  The XML file needed passes the parameters such as IP.
I am aware of the scheduled tasks in the Vconsole.
Top Expert 2010

Commented:
OK...well, I'm all ears (or eyes) :P  I'd be interested to see this myself...

~coolsport00

Author

Commented:
Just cant get thee script to work
Basics are you install converter plug in and the cli tools
then run a command prompt and go to the install directory.  Mine is C:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\Converter Enterprise 4.1.1

then run converter-tool with the appropriate arguments
converter-tool replaced p2vtool if I am not mistaken
Top Expert 2010

Commented:
Well, converter is a plug-in within vCenter (virtual center in previous ESX version); I've only been on VMware for going on 2yrs. We implemented it at ESX3.5/VC2.5, so if there was a tool/plug-in within virtual center called P2Vtool, I'm not aware. There is a separate tool as I mentioned above (standalone), but your script would need to call the plug-in as you state. I'm not too much of a scripter, even tho I'm a Sys Admin. I research (or post questions in the Scripting EE Zone), or get help from my IS side to help me when/if needed. :) Can you post your script that you have thus far?

~coolsport00

Author

Commented:
Yeah you can install standalone then install the command line tools(cli)
You then run converter-tool.exe from its resting spot with the needed arguments
I run converter-tool.exe --vcHost "Hostname" --jV test.xml

I then get reading p2v input file from test.xml
enter username for "Host"
enter password for "host"

Then nothing it drops down to the next line.  I should get some output.
I know the uname and pass have credentials....

<?xml version="1.0" encoding="UTF-8" ?>
<p2v version="2.1" xmlns="http://www.vmware.com/v2/sysimage/p2v"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.vmware.com/v2/sysimage/p2v p2v.xsd"
uninstallAgentOnSuccess="0">
<source>
<liveSpec>
<creds host="XXXX" username="XXXX"
password="XXXX" />
</liveSpec>
</source>
<dest>
<managedSpec datastore="DSXXX" folder="Test" host="XXX" password ="XXX"  vmName="testvm">

<!-- username and password may be omitted, in which case you will be interactively
prompted for credentials -->
<creds host="XXXX" username="XXXX" password="XXXX" />
</managedSpec>
</dest>
<importParams targetProductVersion="PRODUCT_MANAGED" DiskCreateType="MONOLITHIC_FLAT" preserveHWInfo="false" >
<VolumesToClone>



<VolumeCloneInfo resize="false" newSize="38405057024" volumeId="attVol={computer={VOLUME ID HERE},1}" separateDisk = "false"/>* 
</VolumesToClone>* 
</importParams>
<postProcessingParams>
<reconfigParams />
</postProcessingParams>

</p2v>

Open in new window

Top Expert 2010
Commented:
So that's xml/CLI coding? That's certainly beyond my expertise...I'm just a lowly VBS scripter. Sorry Ryan :(

~coolsport00

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial