OSD: How to integrate the BCM agent into an unattended setup

Version 5
    Share:|

    Hi all,

     

    You may have already implemented OS Deployment with BMC ClientManagement and have seen that the easiest option to integrate the BCM Agent is to just capture a WIM image where the agent is installed and deploy the image. May with Windows 7 the capture also had the big benefit that you could already install the windows patches and or some applications. Since Windows 10 is going to receive build upgrades more or lease twice a year you either recreate the image at least once a year or your will install the build upgrade after the image was deployed.

     

    Also if you upgrade BCM you may want also to upgrade the BCM Agent directly in the image. There is a kind of solution by not installing the Agent before the capture and let the deployed Windows install the agent automatically. If you use this way the benefit is you could simply mount the WIM file and replace the agent installer exe file.

     

    When you use the classic unattended mode which is provided by Microsoft and also available with the BCM Deployment module you may already have seen that there is no option in BCM to integrate the Agent by default. But there is an easy solution for it. You only need to create some folders / scripts and add those files to your unattended setup.

     

    The basic steps to integrate the BCM agent are:

    1. Extract your Windows 10 ISO file and make them available on a network share (an ISO file created with the media creation tool kit from Microsoft will not work)

    2. Make your chances to the original files

    3. Add the Windows setup as "Image" to BCM

    4. Create you project and run the unattended setup

     

    I think 1,3 and 4 are quite simple and do not need to be covert by this document.

     

    After you have extracted your Windows ISO file navigate to the sources folder.

    2018-06-09_16-32-54.png

     

    There you need to create the following folder structure:

     

    sources\\$OEM$\$$\SETUP\SCRIPTS

     

    2018-06-09_16-33-54.png

     

    If a file called "SETUPCOMPLETE.CMD" is available in this folder structure the Windows setup will start it automatically as last script.

     

    When you use the following mechanism / script all CMD files in the SCRIPTS folder or SUBFOLDER will be executed

     

    set logfile_setup=%SystemRoot%\Temp\SETUPCOMPLETE.txt
    
    attrib +A -R -S -H %windir%\setup\SCRIPTS\*.* /S /D
    
    rem # Start any existing CMD file (including subfolders
    
    cd %systemroot%\setup\SCRIPTS
    for /D %%f in (*) do (
    pushd %%f
    for %%g in (*.cmd) do call %%g
    popd
    )
    
    rem # Clean up after the setup is done
    if exist %systemroot%\setup\SCRIPTS\done rd /s /q %systemroot%\setup\SCRIPTS 
    

     

     

    So next step is to create a subfolder with a name like "BCMAgent" and place the BCM Agent installer executable in there. Also create a new CMD file which executes the BCM Agent installer.

     

    It could look like this:

    title BCM_Agent
    set Module=BCM_Agent
    echo start %Module% %time% ===================>>%logfile_setup%
    
    echo start /wait "" %SystemRoot%\Setup\Scripts\BCMAgent\BCMAgent.exe >>%logfile_setup%
    start /wait "" %SystemRoot%\Setup\Scripts\BCMAgent\BCMAgent.exe >>%logfile_setup%
    echo %Module% "Errorlevel=%Errorlevel% ">>%logfile_setup%
    
    echo stop %Module% %time% ===================>>%logfile_setup%
    echo.>>%logfile_setup%
    

     

    After this is done just add this to BCM as new "image" and deploy it. After Windows is installed the fresh installed device will already have the BCM agent installed and will connect to your BCM environment.

     

    I have cleaned up some scripts from my BCM toolbox which I've already used for different customer OSD projects. Those are attached to this document as ZIP file. Also the ZIP file contains the folder structure which you need to add to your sources folder. Beside the two mentioned scripts I've also added a CMD file which will change the energy saving settings of the device. By this the device will not go in hibernate mode or standby and keeps running. This could be needed if you want to continue to deploy additional Software.

     

    When the attached scripts are used the Logfile of those scripts will be found in %windir%\temp and it is called SETUPCOMPLETE.txt.

    The Logfile will look like the following example:

     

    2018-06-11_13-01-54.png

     

    As soon as the agent connects to your BCM environment you may want to configure different dynamic device groups to auto assign software distribution rules. As an example what could be done I implanted those scripts and some other within a customer project. Also I've created different Operational Rules which have also set different dependencies. By this a fresh installed device was moved to a group where all Operational Rules have been assigned to. The last rule which runs on a fresh device sends an E-Mail to the ITSM system to start the delivery process.