ctrunk514
asked on
P2V scripting in Windows PowerShell..
P2V scripting
I have a P2V script which is attached that is working but when I try to start the VM using VMware Server Console the server just blue screens each time.
I am also posting the XML config file that I am using.
What I am trying to accomplish is to have my server P2Ved each night deleting the old P2V files as a backup.. also have the script send me an email telling me the start time and end time of the job. I am running this script in windows power shell.
The script works and finishs at 100% and I get the email just as I want. I end up with 2 files 1) servername.vmdk and 2) servername.vmx
And help? Is there a list of switches I can use with the P2VTool.exe? am I using the wrong switches? Im thinking the switch I am using is P2Ving the server for an ESX server and I need to P2V it for VMware Server Console not ESX.
I have a P2V script which is attached that is working but when I try to start the VM using VMware Server Console the server just blue screens each time.
I am also posting the XML config file that I am using.
What I am trying to accomplish is to have my server P2Ved each night deleting the old P2V files as a backup.. also have the script send me an email telling me the start time and end time of the job. I am running this script in windows power shell.
The script works and finishs at 100% and I get the email just as I want. I end up with 2 files 1) servername.vmdk and 2) servername.vmx
And help? Is there a list of switches I can use with the P2VTool.exe? am I using the wrong switches? Im thinking the switch I am using is P2Ving the server for an ESX server and I need to P2V it for VMware Server Console not ESX.
THIS IS THE SCRIPT
#Get the start time for the email message.
$startTime = get-date
&C:\Program Files (x86)\VMware\VMware Converter\P2VTool.exe --import --source
C:\job\nsbb.xml
#Get the finish time for the email message.
$finishTime = get-date
Move-Item C:\ConverterTemp\NSBB\* C:\Converter\NSBB force
Remove-Item C:\ConverterTemp\NSBB
#Set up the email parameters and send the email.
$emailFrom = "Tad@******.com"
$emailTo = "Tad@******.com"
$subject = "VM Migration Task Complete..."
$body = "Your VM Migration started at: $startTime
Your VM Migration completed at: $finishTime
Please log into the Virtual Infrastructure Client to remove
any unnecessary hardware and ensure that the newly migrated
VM is on the correct network."
$smtpServer = "********"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
________________________________________________________________________
THIS IS THE XML CONFIG
<p2v uninstallAgentOnSuccess="0" version="2.2" 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 p2vJob.xsd" xsi:type="P2VJob">
<source>
<liveSpec>
<creds host="10.2.1.8" password="*****" port="0" username="NS\administrator"/>
</liveSpec>
</source>
<dest>
<hostedSpec path="\\10.2.1.6\ConverterTemp" password="******" username="NS\administrator" vmName="NSBB"/>
</dest>
<importParams clonePagefile="true" diskType="MONOLITHIC_SPARSE" keepIdentity="false" preallocateDisks="false" preserveDeviceBackingInfo="false" targetProductVersion="PRODUCT_WS_5X">
<nicMappings preserveNicsInfo="false">
<nicMapping network="Bridged"/>
</nicMappings>
<volumesToClone>
<volumeCloneInfo newSize="12962482790" resize="true" volumeId="attVol={computer={8d56326b536472341b75b4f61b479869dbeb1967},1}"/>
</volumesToClone>
</importParams>
<postProcessingParams installTools="false" powerOnVM="false">
<reconfigParams/>
</postProcessingParams>
<jobState errorCode="0" id="8" startTime="2008-Oct-30 14:39:35" state="beingStopped" totalPercentComplete="18" type="import">
<messages>
<message id="Id_EstablishConnectionToAgent" type="Type_NewStep">
<parameters>
<parameter value="10.2.1.8"/>
</parameters>
</message>
<message id="Id_CreateAndImport" type="Type_NewStep"/>
<message id="Id_CreateConfigInfo" type="Type_Info"/>
<message id="Id_CreateTargetVM" type="Type_Info"/>
<message id="Id_FormatVolumeWithPath" type="Type_Info">
<parameters>
<parameter value="c:"/>
</parameters>
</message>
<message id="Id_SnapshottingVolume" type="Type_Info"/>
<message id="Id_CloningVolumeWithPath" type="Type_Info">
<parameters>
<parameter value="c:"/>
</parameters>
</message>
</messages>
</jobState>
</p2v>
Perhaps I am confused, but you should always have two files... one is disk file and one is config file.
ASKER
OK yes i have 2 file after the script runs, when i use the VMware Converter i can start the server and everthing works. but when i use the script the servre trys to start but blue screen..
I thought I would have time to poke around and figure this out, but alas I have not. I recommend you going to http://communities.vmware.com/community/developer/windows_toolkit and post your question there.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.