Wednesday, February 27, 2013

PXE boot WINPE

As part of our new Windows 7/AD deployment, SCCM is being used to control the imaging process of desktop computers.

We already have a comprehensive set of PXE enabled boot options so we needed a way to integrate the SCCM tools into our existing PXE setup.

The existing setup is syslinux(pxelinux) 3.11 on CentOS 5, ISC dhcpd and tftp.

We have several Linux live CDs, memtest, novell tools, DOS and chain booting to another (novell) server.

Our Microsoft team provide a bootable CD which we can use to image desktop machines and on some subnets they now provide the ability to PXE boot. Initially I hoped we could just chain boot to the SCCM server but that does not work.

After much research and testing I worked out a process using wimboot. Based on instructions found on http://ipxe.org/howto/sccm and http://forum.ipxe.org/showthread.php?tid=5745 I managed to write a script which converts a CD (ISO image).

The pxelinux entry is:
LABEL ad
com32 ad/linux.c32
append ad/wimboot initrd=ad/winpe.cpio


The files are in a tftp subdirectory called ad

linux.c32 is part of syslinux. I am using version 4.02 which was copied from a CentOS 6 server.

wimboot is available for download from ipxe.

winpe.cpio is a file we are going to create using my script below.

I also required a copy of bootmgr.exe which should be available on your microsoft tftp server but I was unable to find it and in the end I got a copy from our Mircosoft team.

Finally, I needed a copy of wimlib which has a linux version of the imagex tool. I was unable to find a RPM of this package and I just built it from source using the --without-ntfs-3g. (The source comes with .spec files so an RPM should be easy to build).

So here is my script:
convert_cd_into_pxe.sh:
#!/bin/bash
# Written by John Newbigin jnewbigin@chrysocome.net
ISO=x86_PROD_MS.iso

MNTPNT=wim
SCCMFILES=iso

IMAGEX=./wimlib-1.2.5/imagex

unalias cp

if [ "$(whoami)" = "root" ] ; then

   if [ ! -f bootmgr.exe ] ; then
      echo "You need a copy of bootmgr.exe"
      exit 1
   fi
   umount $SCCMFILES
   mkdir $SCCMFILES
   mkdir $MNTPNT
   mount -o loop $ISO $SCCMFILES

   cp $SCCMFILES/boot/bcd BCD
   cp $SCCMFILES/boot/boot.sdi .
   cp $SCCMFILES/sources/boot.wim .


   $IMAGEX mountrw boot.wim 1 $MNTPNT

   cp -drv $SCCMFILES/sms/* $MNTPNT/sms/
   umount $SCCMFILES
   rmdir $SCCMFILES

   ARCH=$(grep TsBootShell.exe $MNTPNT/Windows/System32/winpeshl.ini | cut -d \\ -f 4)
   # edit winpeshl.ini
   perl -pi -e "s|.*$ARCH.*|\"wscript.exe\",\"%SYSTEMDRIVE%\\\\sms\\\\bin\\\\$ARCH\\\\bootstrap.vbs\"|" $MNTPNT/Windows/System32/winpeshl.ini

   # install bootstrap.vbs
   cat > $MNTPNT/sms/bin/$ARCH/bootstrap.vbs << END
Set os = WScript.CreateObject ( "WScript.Shell" )
os.Run "%COMSPEC%", 7, false
os.Run "%COMSPEC% /c title Initialising... && wpeinit " & _
"&& net start dnscache", 1, true
os.Run WScript.ScriptFullName & "\..\TsmBootStrap.exe /env:WinPE " & _
"/configpath:%SYSTEMDRIVE%\sms\data", 1, true
END

   $IMAGEX unmount $MNTPNT --commit
   rmdir $MNTPNT

   ls BCD bootmgr.exe boot.sdi boot.wim | cpio --create -H newc > winpe.cpio
   rm BCD boot.sdi boot.wim
  
else
   echo "You must be root to run this script"
   exit 1
fi


I hope this is of use to someone.

35 comments:

  1. As off WinPE 4, there are a few minor changes to the script which are required. These are to support UDF filesystem, File name case changes and UCS-2 encoded files.

    I will post a new version soon.

    ReplyDelete
  2. I recently had a new problem with the process. Identical to this http://lists.ipxe.org/pipermail/ipxe-devel/2013-August/002716.html
    After much testing and experimentation I found a rather simple fix, Just create these registry keys
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PXE]
    "BootServerReply"=hex:
    "DHCPServerACK"=hex:

    ReplyDelete
  3. I have just made my first attempt utilizing this technique!

    test here

    ReplyDelete
  4. Actually I read it yesterday but I had some thoughts about it and today I wanted to read it again because it is very well written. 스포츠토토

    ReplyDelete
  5. It's very informative and you are obviously very knowledgeable in this area. You have opened my eyes to varying views on this topic with interesting and solid content. No doubt it is helpful. 바카라사이트

    ReplyDelete
  6. I truly appreciate basically perusing the majority of your weblogs. I am trying to find issues to improve my website! I assume its good enough to make use of a few of your ideas! 파워볼

    ReplyDelete
  7. An obligation of appreciation is all together for the better than average blog. It was amazingly useful for me. I m playful I found this blog. 카지노사이트

    ReplyDelete
  8. تمثل المكيفات دور هام في حياتنا في اشهر الصيف
    بغض النظر عن أنها يمكن أن تخلصك من الحرارة، لكن يؤكد كثير من الباحثين أن مكيفات الهواء غير صحية، حيث إن لها العديد من الآثار السلبية على صحتك إذا لم يتم تنظيفها بانتظام.
    تعمل عملية تنظيف المكيفات علي التخلص التام من الاوساخ و الاتربة التى تكون عالقة بالتكييف و التى تسبب العديد من امراض الحساسية، زيادة قوة دفع الهواء الخارج من المكيف، حماية التكييف من الاعطال المحتملة و المتكررة
    كما تساعد على خروج الهواء النقي
    شركة الهرم تقدم خدمات تنظيف المكيفات بالادوات الخاصة للمكيف مع ارخص الاسعار وعمالة مدربة ومتخصصون في هذا المجال
    تكييف الهواء هو جهاز يثبت في الغرف أو السيارات ونحوها، وتديره القوة الكهربية، لتقوم بخفض الحرارة فتبرد الجو في فصل الصيف أو يتم رفعها في فصل الشتاء حتى تقوم بتدفئة الجو، ويوجد العديد من أنواع أجهزة التكييف فمنها ما هو مناسب للمنازل ومنها ما يناسب الشركات والمصانع وحتى المراكز التجارية والمعروف عن أجهزة التكييف هو حاجتها للتنظيف باستمرار وبطريقة معينة حتى لا تتسبب الأتربة في تلفها.
    شركة تنظيف مكيفات بخميس مشيط
    يعتبر التكييف من أساسيات الأجهزة الكهربائية في المنزل بسبب درجات الحرارة المرتفعة، لذلك يحرص الجميع على تنظيفه باستمرار من الأتربة أو الشوائب للحفاظ عليه من الأعطال والتلف
    يوجد العديد من الشركات التي تتيح خدمات تنظيف المكيفات و لعل من اهم تلك الشركات شركتنا و التي تعد واحدة من اهم شركات تنظيف المكيفات بالاعتماد على احدث الاجهزة و المعدات و بتنفيذ امهر العمال و الفنيين.
    شركة تنظيف مكيفات

    ReplyDelete
  9. "You are so intriguing! I figure I haven't really scrutinized anything equivalent already.
    It's uncommon to find someone who has a certified idea on this point.
    Genuinely, thank you for starting this.
    ※사설토토※사설토토사이트※토토사이트※
    오랫동안 많은 업체들과 함께 데이터 베이스를
    구축하였으며 유져님들께서 안전한 놀이터
    및 메이저 사이트에서 부담없이
    최적의 스포츠게임을 즐기실수 있게 최고의
    토토사이트를 제공해드립니다
    ※토토사이트 검증※
    추천받으실수 있습니다.
    This webpage is a necessary thing on the Internet,
    somewhat creative person!토토사이트
    "

    ReplyDelete
  10. This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.

    Osport.lt
    Information
    Click Here
    Visit Web

    ReplyDelete
  11. Which is some inspirational stuff. Never knew that opinions might be this varied. Thank you for all the enthusiasm to provide such helpful information here.바카라사이트 It helped me a lot. If you have time, I hope you come to my site and share your opinions. Have a nice day.

    ReplyDelete
  12. Buying a business does not have to be a complicated endeavor when the proper process and methodology is followed. In this article, we outline eleven specific steps that should be adhered to when buying a business and bank financing is planned to be utilized. 메이저토토사이트추천

    ReplyDelete
  13. While looking for articles on these topics, I came across this article on the site here. As I read your article, I felt like an expert in this field. I have several articles on these topics posted on my site. Could you please visit my homepage? 토토사이트모음

    ReplyDelete
  14. Amazing content. Keep sharing the great work. Kansas city countertops

    ReplyDelete
  15. This website is a one-stop shop for all of the information you needed but didn't know who to ask. You'll definitely notice it if you take a look here. | Check us

    ReplyDelete
  16. I have a question, I bought an Acer laptop last month and with preinstalled win10, but I downgraded It to win7, and the boot message always show PXE boot, how can I remove It? It's very irritating. I'm using it in our office at www.mcallendrywall.com

    ReplyDelete
  17. It's very informative and you are obviously very knowledgeable in this area. kitchen remodel contractor

    ReplyDelete
  18. Initially I hoped we could just chain boot to the SCCM server but that does not work. auto repair near me

    ReplyDelete
  19. This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it. Mold Removal San Antonio Texas

    ReplyDelete
  20. The article you have shared here very awesome. I really like and appreciated your work. Arlington TX flooring tile installation

    ReplyDelete
  21. I am trying to find issues to improve my website! I assume its good enough to make use of a few of your ideas foundation repair services

    ReplyDelete
  22. As I read your article, I felt like an expert in this field. drywall service

    ReplyDelete
  23. I have several articles on these topics posted on my site. Mold inspection in Miami Florida

    ReplyDelete
  24. your website is very nice, the article is very enlightening, I wish you continued success. สล็อตค่าย RT

    ReplyDelete
  25. Since the slot machines are integral to acquiring TM64 in all different versions, Korean versions of those video games will often reward the player with the TM whereas speaking to the Game Corner's receptionist. Sometimes you might be} supplied holds, which in principle will increase your chances. If you 카지노 사이트 might be} supplied hold three times in a row, practically all video games will spin within the win next if you press the hold buttons a 3rd time. Except that mentioned win is normally less than value of|the price of} the 4 plays it took to get it.

    ReplyDelete
  26. Thanks for sharing this article ! it's really useful
    Accountants

    ReplyDelete
  27. wimboot is available for download from ipxe.Read more

    ReplyDelete