<div dir="ltr">Hi,<div><br></div><div>I tried as you suggested, but floppy is not getting attached it seems. below is the code</div><div><br></div><div><br></div><div><br></div><div><b><u>Steps followed:</u></b></div><div>
<br></div><div>I. Create windows VM</div><div>II. installed host agent</div><div>III. <b><span style="font-size:12pt;font-family:'Times New Roman',serif">To
seal a Windows virtual machine with sysprep</span></b></div>
<ol start="1" type="1">
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">In the Windows virtual machine to be used as a
template, open a command line terminal and type <b>regedit</b>. </span></li>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">The <b>Registry Editor</b> window displays. On the left
pane, expand <b>HKEY_LOCAL_MACHINE</b> → <b>SYSTEM</b> → <b>SETUP</b>. </span></li>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">On the main window, right click to add a new string
value using <b>New</b> → <b>String Value</b>. Right click on the string
value file and select <b>Modify</b>. When the <b>Edit String</b> dialog
box displays, fill in the provided text boxes: </span></li>
<ul type="circle">
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Value name: </span><span style="font-size:10pt;font-family:'Courier New'">UnattendFile</span><span style="font-size:12pt;font-family:'Times New Roman',serif"> </span></li>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Value data: </span><span style="font-size:10pt;font-family:'Courier New'">a:\sysprep.xml</span><span style="font-size:12pt;font-family:'Times New Roman',serif"></span></li>
</ul>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Launch sysprep from </span><span style="font-size:10pt;font-family:'Courier New'">C:\Windows\System32\sysprep\sysprep.exe</span><span style="font-size:12pt;font-family:'Times New Roman',serif"> </span></li>
<ul type="circle">
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Under <b>System Cleanup Action</b>,
select <b>Enter System Out-of-Box-Experience (OOBE)</b>. </span></li>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Tick the <b>Generalize</b>
checkbox if you need to change the computer's system identification
number (SID). </span></li>
<li class="MsoNormal" style="margin-left:0.5in;text-align:left"><span style="font-size:12pt;font-family:'Times New Roman',serif">Under <b>Shutdown Options</b>,
select <b>Shutdown</b>. </span></li>
</ul>
</ol>
<p class="MsoNormal" align="left" style="margin-left:0.5in"><span style="font-size:12pt;font-family:'Times New Roman',serif">Click
<b>OK</b>. The virtual machine will now go through the sealing process and shut
down automatically. </span></p><p class="MsoNormal" align="left" style="margin-left:0.5in"><span style="font-size:12pt;font-family:'Times New Roman',serif"><br></span></p><p class="MsoNormal" align="left" style="margin-left:0.5in">
<span style="font-size:12pt;font-family:'Times New Roman',serif"><br></span></p><p class="MsoNormal" align="left" style="margin-left:0.5in"><span style="font-size:12pt;font-family:'Times New Roman',serif">IV. </span></p>
<p class="MsoNormal" align="left" style="margin-left:0.5in"><br></p><div><span class="" style="white-space:pre">                        </span> org.ovirt.engine.sdk.decorators.VM vm1 = api.getVMs().get(vmName);</div><div><span class="" style="white-space:pre">                        </span> Payloads payloads = new Payloads();</div>
<div><span class="" style="white-space:pre">                        </span> Payload payload = new Payload();</div><div><span class="" style="white-space:pre">                        </span> payload.setType("floppy");</div><div><span class="" style="white-space:pre">                        </span> </div>
<div><span class="" style="white-space:pre">                        </span> Files payloadFiles = new Files();</div><div><span class="" style="white-space:pre">                        </span> File payloadFile = new File();</div><div><span class="" style="white-space:pre">                        </span> payloadFile.setName("sysprep.xml");</div>
<div><span class="" style="white-space:pre">                        </span> payloadFile.setContent("<?xml version=\"1.0\" encoding=\"utf-8\"?> <unattend xmlns=\"urn:schemas-microsoft-com:unattend\"> <b>FILE CONTENT </b>"</unattend>");</div>
<div><span class="" style="white-space:pre">                        </span> payloadFiles.getFiles().add(payloadFile);</div><div><span class="" style="white-space:pre">                        </span> payload.setFiles(payloadFiles);</div><div><span class="" style="white-space:pre">                        </span> vm1.setPayloads(payloads);</div>
<div><span class="" style="white-space:pre">                        </span> Action action = new Action();</div><div><span class="" style="white-space:pre">                        </span> vm1.start(action);</div><div><br></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Thu, Mar 27, 2014 at 3:52 PM, Itamar Heim <span dir="ltr"><<a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/27/2014 06:18 AM, Tejesh M wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Can you guide me on sysprep with sample code & sysprep file?<br>
<br>
</blockquote>
<br>
just launch a windows VM, look at the generated sysprep file we pass to the VM via the floppy disk.<br>
then pass it as a payload as-is.<br>
then try to change what you want.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On Thu, Mar 27, 2014 at 3:16 PM, Itamar Heim <<a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a><br>
<mailto:<a href="mailto:iheim@redhat.com" target="_blank">iheim@redhat.com</a>>> wrote:<br>
<br>
On 03/27/2014 05:33 AM, Tejesh M wrote:<br>
<br>
Hi All,<br>
<br>
I was doing google to see if i can set Hostname,Password & IP<br>
details<br>
for Windows server from RHEV-M. I got to know that we can create VM<br>
Payload & send that to Windows VM (installed with Cloud-init)<br>
<br>
Refer this link<br>
<a href="http://www.cloudbase.it/cloud-__init-for-windows-instances/#__comment-9411" target="_blank">http://www.cloudbase.it/cloud-<u></u>__init-for-windows-instances/#<u></u>__comment-9411</a><br>
<<a href="http://www.cloudbase.it/cloud-init-for-windows-instances/#comment-9411" target="_blank">http://www.cloudbase.it/<u></u>cloud-init-for-windows-<u></u>instances/#comment-9411</a>><br>
<br>
Cloud-init expects Meta-data & User-Data file to be sent either via<br>
Config Drive or via HTTP. I'm trying to achive this via ConfigDrive<br>
(created using VM Payload).<br>
<br>
<br>
note you can also just pass the full sysprep file as a payload<br>
yourself via the API, and set all these items in it.<br>
<br>
<br>
But i'm wondering what should be the format of this two files<br>
(Meta-data<br>
& User-data). Have any1 tried this? If yes, would request to share<br>
sample for both the files with setting Hostname, Password & IP<br>
details.<br>
<br>
<br>
just launch a linux VM and check the file we create?<br>
<br>
<br>
Java code:<br>
<br>
org.ovirt.engine.sdk.__<u></u>decorators.VM vm1 =<br>
api.getVMs().get(vmName);<br>
Payloads payloads = new Payloads();<br>
Payload payload = new Payload();<br>
payload.setType("cdrom");<br>
<br>
Files payloadFiles = new Files();<br>
File payloadFile = new File();<br>
payloadFile.setName("meta-__<u></u>data.txt");<br>
payloadFile.setContent("__<u></u>hostname:"+vmName);<br>
payloadFiles.getFiles().add(__<u></u>payloadFile);<br>
payload.setFiles(payloadFiles)<u></u>__;<br>
vm1.setPayloads(payloads);<br>
Action action = new Action();<br>
vm1.start(action);<br>
<br>
--<br>
Thanks & Regards<br>
Tejesh<br>
<br>
<br>
<br>
<br><span class="HOEnZb"><font color="#888888">
<br>
--<br>
Thanks & Regards<br>
Tejesh<br>
</font></span></blockquote>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Thanks & Regards</div>
<div>Tejesh</div>
</div>