Imaging unknown computers, and adding them to collections with the custom boot wizard

May 16, 2012 at 5:54 PM

Hi Maik,

Previously we had simply used the custom boot wizard to handle all re-imaging of our known computers, but since moving to CM2012 we were hoping to be able to use the custom boot image wizard to also image any unknown computers.

I added a section in the ZTIMediahook to check against the webservice if the computer is known or unknown as a preliminary step, however after that I'm having trouble.  When booting an unknown computer, we get the list of collections with OSD TS's available to them, but after making our selection it just sits and runs through the HasOSDAdvertisement step over and over, stating that there is an advertisement for the computer...but it never goes anywhere.  It finished iterating 25 times and then exits.

If I check in the CM console, I see that there is a computer that has been added and given the name of the computer's MAC address, and that there is a direct membership rule on the collection, but the computer does not appear there.

I'm currently working on a method to prompt for a computer name if it is unknown when the wizard launches, but I don't want to have to re-create the wheel if there's already a solution for getting unknown computers to interact/behave correctly.

Am I missing something obvious here?

May 16, 2012 at 6:49 PM

Update: I've noticed that when ZTIMediahook runs the AddComputerToCollection service call, I get a notification that there was no valid parameter set for COMPUTERNAME...this looks like what I want to be able to set manually with the IsComputerKnown section I have, but I'm unsure as to how/where to set that.  Thoughts or suggestions?

As a side note, I had an "unknown" test machine finally go through to the imaging process after iteration #16 or so after being added to the collection.

May 16, 2012 at 10:36 PM

Update 2: Completely stumped as to why the AddComputerToCollection call isn't finding the correct name.  I've tried updating ComputerName, HostName, and OSDComputerName through various VB scripting (oEnvironment.Item("OSDComputerName")), as well as adjusting the settings in appropriate SCCM_Bootstrap.ini section (OSDComputerName=ComputerName)...though for whatever reason, it is still using the MAC address for the computer name when it adds the computer to the server.  I'm really at a loss here on this one...what variable needs to be set during the ZTIMediahook execution to change the computer name???  I'll sleep on it and try again tomorrow :/

May 17, 2012 at 7:36 PM

Update 3: Ok, I've hacked a method for defining the machine using the check to see if the system was known, if not then it gives a vbs prompt for the name.  This data is then written into the VARIABLES.DAT file (data from SCCM_Bootstrap.ini set by the previously run ZTIGather), when the AddComputerToCollection service call is run, it correctly includes the computer name for the DDR in SCCM.

The problem now, however, is that if I look in the collection membership rules I can see the newly created machine listed as a direct membership...BUT! when browsing the collection, the actual computer doesn't show up for anything.  What I had to do was delete the membership rule and manually add the newly created DDR into the collection...after that, it booted fine and is currently being imaged. 

What I'm going to try and do next is have a step to add the computer to SCCM during my known/unknown check...that way the computer account already exists when the wizard tries to add it to a collection (which IS working for our known computers).

May 18, 2012 at 5:23 AM
Edited May 18, 2012 at 5:27 AM

Update 4: After testing the things from the command prompt in WinPE for a while I finally put it all together in the boot image and tested it a couple times...only to find that the script bombs out.  Of particular note, I found that the VARIABLES.DAT file does not get created when the pre-execution hook is run when the boot image first comes up (or if it does, then it is getting stored in another folder somewhere...still looking into that)...if I run the script from the command prompt (cscript x:\deploy\scripts\ztimediahook.wsf) then VARIABLES.DAT shows up with the other log files as it was supposed to.  Due to this behavior for the DAT file, I've redesigned the script to modify the SCCM_Bootstrap.ini file instead.  In the morning I'll take a look at ZTIGather.xml, as I'm realizing I might be able to accomplish my goals there, and by manipulating the oEnvironment.Item("myVariable") options (tried scripting with the oEnvironment.Items early, early on, but likely may have had something mismatched in my BS.ini)

(My updates are looking more like blog posts at this point! :P )

May 18, 2012 at 5:25 PM

Update 5: Dear I swallowed a all seriousness though, found where variables.dat is getting created (x:\sms\data\), and all the data is encrypted, so no directly modifying that anymore >_<

As a side note...the previous script failure was failing due to forgetting to change an item when I added the AddComputer function (mk:boolean -> mk:int > 0)

I believe I have a working model now, despite all this...I ended up changing things in my BS.ini a bit and added ComputerName to the Properties, and under the Default section I set ComputerName=#oEnvironment.Item("ComputerName") the ZTIMediahook.wsf script I set oEnvirontment.Item("ComputerName") to the input I gathered previously.  The webservice calls reflect the updated computer name using that method, so I think we're good there.

So now the script checks to see if the computer is known, if not then it prompts for a name and then adds the computer to SCCM.  The wizard then launches and I can add the computer to an OSD collection.  I still noticed that a direct membership for the computer name is listed under the collection properties, but that browsing the collection does not show the least not right away.  It eventually showed up in the collection, after iteration #6 or so of "Waiting for Advertisement..." at which point it continued to load and launched the selected OSD TS.

Jun 18, 2012 at 9:24 PM

Hey ,

I think you are overkilling here a bit with your approach. Whats your naming convention for computers ? Is it dependents on something specific ? I have one TS for know and unknown computers - 100% ZTI with complete autonaming patching and moving to specific OU and bitlocking ;)

Im more than happy to help you out if needed ;)

Jun 19, 2012 at 2:20 PM

The initial bit with directly modifying the variables.dat and BS.ini files was probably too much...I was pretty much grasping as whatever I could :)  (though, I later found out that the editable version of variables.dat which I was working with, was not the actual dat file created when the wizard first started...that file was located somewhere like x:\smsdata\...\... and was all no editing happening there).

Our naming convention is broken down first by a 3 digit code for building location, and then followed by either a room number or username (in some buildings), and then a two digit number to specify which workstation it is in the event of multiple workstations per room.  This makes a ZTI for barebones imaging difficult.

What I have running now is this...firstly I modified the wizard.hta file to include a password verification in order to prevent any unauthorized access (since we have PXE password protection disabled...that way we can still have remote PXE imaging without needing to enter a password for a required TS).  I also used the IsComputerKnown webservice call to check and see if the computer has a DDR.  The problem I was running into with using the custom boot wizard for unknown computers, is that even though the computer was getting created in sccm and added to a collection, in the end there was also another DDR getting created for the same computer using the MAC address (I suspect this is similar to how a computer will be listed in the direct membership of an OSD collection, but not actually show up for a few minutes).

This being the case, I too have a single TS for image deployments...I then deployed the TS to unknown computers and if the IsComputerKnown check returned false, then after entering the password in the wizard, it would cancel the hta and proceed onto the TS for unknown computers (where I have the OSDComputerName variable waiting to be set).  This correctly images the workstation and adds the appropriate DDR to SCCM.

As a side note, imaging for known computers has never been an issue and still continues to work without any issue.