IT Management Suite

How To: Make your WinPE Image Universal Across Multiple DSs 

Dec 21, 2010 04:17 PM

If you manage a lot of DS servers and you need your WinPE image to be consistent across all of them but still need to be able to map different drives depending on which DS a machine boots to, this may be a good solution for you.

I got tired of having to rebuild the WinPE image on all 11 of my servers every time a new model came in and I had to add drivers, and during our migration to WinPE, I was always doing something stupid like missing a check box here or there, or getting a typo in a drive mapping's path... so I sought out a way to automate it all. 

I used boot disk creator (BDC) in the PXE config to do all of this on my test server, DS0. Then I copied the WIM files (and nothing else) over to each of the production servers and tested it. Because we were still in the pilot phase of migrating from Linux to PE when I developed this, I could completely break PE on a production server without a lynch mob coming for me. ;)

We're running DS 6.9 SP2, and this uses WinPE 2.1.  It ought to work in other versions too, but I have not tested anything but DS 6.9 sp2.  As long as the %ALTIRIS_PXE_SERVER% variable is available to you, this ought to work.

First off - I had to build a little intelligence into the image so that it would work everywhere.

in BDC:

step 6 - drive mappings - delete mapping to F and map Z: to \\%ALTIRIS_PXE_SERVER%\express - this maps to the DS it's booting from, and putting it on Z prevents issues with some OEM images that have lots of partitions and/or removable/optical drives.

also step 6 - uncheck LMHOSTS - I populated LMHOSTS with every server's IP in step 9.

step 9 - do the following edits.  Obviously replace "DS#" with your servers' actual names.  Keep in mind this IS Case Sensitive!

userenv.bat

rem optionally hide this window
x:\wndctl -hide
echo.
echo.
echo Booting from %ALTIRIS_PXE_SERVER%...
del x:\aclient.inp
echo InitialSettings=Yes > x:\aclient.inp
echo SettingsChanged=Yes >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS0 echo TcpAddr=(IP of DS0) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS1 echo TcpAddr=(IP of DS1) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS2 echo TcpAddr=(IP of DS2) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS3 echo TcpAddr=(IP of DS3) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS4 echo TcpAddr=(IP of DS4) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS5 echo TcpAddr=(IP of DS5) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS6 echo TcpAddr=(IP of DS6) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS7 echo TcpAddr=(IP of DS7) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS8 echo TcpAddr=(IP of DS8) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS9 echo TcpAddr=(IP of DS9) >> x:\aclient.inp
if %ALTIRIS_PXE_SERVER%==DS10 echo TcpAddr=(IP of DS10) >> x:\aclient.inp
echo TcpPort=402 >> x:\aclient.inp
echo InstallDir=C:\Altiris\AClient >> x:\aclient.inp
rem following 2 lines are optional and depend on your environment.
echo SyncTimeWithServer=No >> x:\aclient.inp
echo Password=XXXXXX >> x:\aclient.inp

rem add an LMHOSTS entry for each of your DSs, servers you'll be mapping drives to, domain controllers, and any others you think you might need
echo 10.1.1.1    DS1 >> x:\windows\system32\drivers\etc\lmhosts
echo 10.1.1.2    DS2 >> x:\windows\system32\drivers\etc\lmhosts
...
echo 10.2.2.1    NS1 >> x:\windows\system32\drivers\etc\lmhosts
echo 10.2.2.2    NS2 >> x:\windows\system32\drivers\etc\lmhosts
...
echo 10.3.3.3    NTP-SRV >> x:\windows\system32\drivers\etc\lmhosts
echo 10.5.5.5     DC1 >> x:\windows\system32\drivers\etc\lmhosts
echo 10.5.5.6     DC2 >> x:\windows\system32\drivers\etc\lmhosts
echo 86.7.53.09    JENNY >> x:\windows\system32\drivers\etc\lmhosts

Note - TcpAddr should not have parentheses. ex: TcpAddr=10.1.1.1
Also - I am appending entries to the LMHOSTS file in this manner so as not to overwrite any that might already be there.


startup.bat

rem optionally hide this window
x:\wndctl -hide
if %ALTIRIS_PXE_SERVER%==DS0 net use y: \\NS1\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS1 net use y: \\NS1\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS2 net use y: \\NS1\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS3 net use y: \\NS1\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS4 net use y: \\NS2\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS5 net use y: \\NS2\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS6 net use y: \\NS2\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS7 net use y: \\NS2\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS8 net use y: \\NS3\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS9 net use y: \\NS3\images /USER:domain\username password
if %ALTIRIS_PXE_SERVER%==DS10 net use y: \\NS3\images /USER:domain\username password

Note - we use our three NS servers to distribute the load for hosting image files, drivers, and HII scripts.  During an image job, only WinPE and the agent files come from the DS itself.  

Steps 10-12 just hit next, next, finish.

I would have preferred to use a .pwl file so that the password wasn't in plaintext, but considering that the only people who have access to BDC already know the password to the network service account, we're probably ok. None of that shows up on-screen besides the  optional "Booting from..." echo statement at the beginning anyway.  

To go one step further, if you already have the keyboard locked in WinPE, you can add "x:\wndctl -hide" to the beginning of each batch file as shown, and the dos-style window won't even appear on screen, giving a nice, clean look.  If you don't have the keyboard locked (what?) then you'll need to add wndctl.exe to the WinPE 2.x additional files root folder to be able to hide the windows.  This file lives in the express\PXE subdirectories.

So... basically this thing looks to see which server it's booting from, maps the express share to the proper server, builds aclient.inp so it will connect to the right DS, appends some entries to LMHOSTS, and then maps another drive depending on which DS it's on.

If a given DS doesn't have WinPE yet, I simply install it with all the defaults, since they will soon be overwritten anyway.  Make sure to restart PXE manager service on that DS after you finish installing WinPE.  

If a given DS already has WinPE installed and available on the boot menu, you're good to go. No need to restart anything.

Once you're done modifying everything in WinPE on DS0 (dev server), be sure to restart PXE manager service on DS0 before going to the next step.  

To replicate the image, I use robocopy to copy these two files from DS0 (dev server) to the corresponding directories on the production servers (1-10):
\\ds0\eXpress\PXE\Images\MenuOption131\X86PC\sources\boot.wim
\\ds0\eXpress\PXE\MasterImages\MenuOption131\X86PC\sources\boot.wim

I also copy the following dir to corresponding dirs on the other DSs so that if I had some weird emergency where I had to edit WinPE on an individual DS, I would at least already have all the drivers needed.  This step isn't necessary, but I do it Just In Case.
\\ds0\eXpress\Bootwiz\platforms\Winpe2\x86\Drivers\CUSTOM\Drivers

One nice thing is that even though you have to restart PXE services on DS0 (test server) you do NOT have to restart them on the destination servers - another great time-saver.  If the files happen to be in use on the destination DS, then you just have to wait for them to be released by the clients.  Robocopy automatically retries in this case, so it's not much of an issue for me.

The drivers copy does not replicate the logic I built in, but at least the drivers will be there, which for me can get quite time-consuming.  The scripts and stuff can be cut & pasted into BDC anyway, so it's not really that much of a problem.  I looked into trying to copy over the files where it keeps the scripts and stuff, and it got messy pretty fast, what with editing INI files and such, and that defeated the purpose of automating this process, so I didn't spend much time on it.  If I ever get caught up (HA!!!) I'll look into it again, since a true replication should include these parts and allow it to be edited per-DS... which right now it doesn't.  

One thing worth repeating is that unlike windows networking, the IF statements used here DO care about UPPER/lower-case.  A server named "DS1" is not the same as one named "Ds1" when it comes to the scripts.  IF is picky, so pay close attention to that.

CAVEATS:
- If you use multicast for imaging, you might need to do more testing. We don't use mcast so I didn't bother making sure those settings are correct or not. From what I've seen though, you'll probably just need to add in a few lines for your aclient.inp auto-generation, using the same/similar variable and IF statements. 
- You might not be able to use PXE config on the production DSs to change the image on just that DS if you ever need to. I won't - our environment requires consistency across all of them, so I did not test for this. It would be good practice to only modify settings on the test server first anyway, and once you have the wrinkles ironed out, simply run your COPYWIMs.bat (the robocopy commands) and move on to your next task.

This has made my job much easier.  Before when I added a new model that needed drivers for WinPE, I had to go through the edit/add/recompile/restart/test process for WinPE on each of my 11 DSs, potentially putting it out of commission while I did so.  At 20-30 mins each, that gets old FAST, and leaves a lot of margin for error.  Now I go through that process ONCE on a safe environment, then run a batch file that takes like 2 minutes to run, and I'm done.  Boy am I relieved!

By the way - if you ever realize you really messed up WinPE on your test environment, simply copy the two WIM files from one of your production servers back to the test server.  Boom - an easy, no hassle fix. 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Dec 28, 2010 02:18 PM

Yes, in this setup, the DS servers are also the PXE servers.  That's an mportant distinction to make - thanks for pointing it out.  While the overall procedure will probably still work if your DS is not the same box as your PXE server, you'll need to take that into account when mapping your drives.

Funny thing is though - in the environment i originally did this for, there are almost 80 sites!  Thankfully, through the magic of private fiber, we got away with only needing 10 DSs, each feeding an average of 8 locations.  Ugh, I can't imagine trying to manage 80 DSs! 10 was MORE than enough for one person to handle.

Dec 23, 2010 09:49 AM

Nice work.

I assume you're not using stand-alone PXE-Servers (let's call it "Site PXE")??
There is a full DS on every site?

Otherwise, your universal image will not work. Every client needs access to the temp directory of its Deployment Server. Since you're using the %ALTIRIS_PXE_SERVER% variable, your image connects either to the PXE Server on the DS or to the stand-alone PXE-Server (which doesn't have a DS-temp directory where all the scripts get pulled from).

Related Entries and Links

No Related Resource entered.