none
Run a script before the selection of Applications RRS feed

  • Question

  • Hi,

    I would like to run a commande line before the panel of the selection of the applications.  The command will change a registry key in windowspe because we have too much application and we need to extend the time before a time out.

    If I add a command line at the top of the tasksequence, the change will work but too late.  If I do it manually in my wim, I will need to do it again if I regenerate the image ?

    Thanks

    Tuesday, May 26, 2015 8:30 PM

Answers

  • To add to Ty Glander's comment:

    You can modify the 'master' winpe.wim file by doing the following:

    1. Navigate to "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\ARCH\en-us"
      Where ARCH is the architecture of your WinPE media: amd64 or x86
    2. Backup the existing winpe.wim file!
    3. Mount the WIM
    4. Make your changes
    5. Commit the WIM
    6. Unmount & commit the wim
    7. Rebuild your boot media.

    Any time you update the deployment share, regenerate your media, it'll have that change as long as it is performed on a machine that has the updated winpe.wim!



    Wednesday, May 27, 2015 4:18 PM
  • It should also be noted that when WinPE loads, it runs 'wscript.exe  X:\Deploy\Scripts\LiteTouch.wsf'

    This is controlled via an XML file.

    You can edit the template XML file to run a script before LiteTouch.wsf runs by doing the following:

    1. Navigate to "C:\Program Files\Microsoft Deployment Toolkit\Templates"
    2. Locate a file called "Unattend_PE_ARCH.xml"
      Where ARCH is the architecture of your WinPE media: x64 or x86
    3. Backup this file!
    4. Edit the file appropriately (see examples below)
    5. Rebuild your boot media
    6. Test: Your script will launch before LiteTouch.wsf

    Here's an example of what a stock Unattend_PE_x64.xml file looks like:

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>32</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
                <RunSynchronous>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>1</Order>
                        <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
            </component>
        </settings>
    </unattend>


    Here is my modified version that executes a script prior to running LiteTouch.wsf.
    The areas in bold are the areas that require changes.

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>32</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
                <RunSynchronous>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>1</Order>
                        <Path>wscript.exe X:\Path\To\Custom\Scripts.wsf</Path>
                    </RunSynchronousCommand>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>2</Order>
                        <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
            </component>
        </settings>
    </unattend>


    In my example, I'm referencing another .WSF but it could be .VBS, .BAT. CMD etc..


    Any time you update the deployment share, regenerate your media, it'll have that change as long as it is performed on a machine that has the updated .XML template!




    Wednesday, May 27, 2015 4:33 PM

All replies

  • You could modify the winpe.wim that your boot images are generated from.  That should only have to be a 1 time thing.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, May 26, 2015 9:07 PM
    Moderator
  • To add to Ty Glander's comment:

    You can modify the 'master' winpe.wim file by doing the following:

    1. Navigate to "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\ARCH\en-us"
      Where ARCH is the architecture of your WinPE media: amd64 or x86
    2. Backup the existing winpe.wim file!
    3. Mount the WIM
    4. Make your changes
    5. Commit the WIM
    6. Unmount & commit the wim
    7. Rebuild your boot media.

    Any time you update the deployment share, regenerate your media, it'll have that change as long as it is performed on a machine that has the updated winpe.wim!



    Wednesday, May 27, 2015 4:18 PM
  • It should also be noted that when WinPE loads, it runs 'wscript.exe  X:\Deploy\Scripts\LiteTouch.wsf'

    This is controlled via an XML file.

    You can edit the template XML file to run a script before LiteTouch.wsf runs by doing the following:

    1. Navigate to "C:\Program Files\Microsoft Deployment Toolkit\Templates"
    2. Locate a file called "Unattend_PE_ARCH.xml"
      Where ARCH is the architecture of your WinPE media: x64 or x86
    3. Backup this file!
    4. Edit the file appropriately (see examples below)
    5. Rebuild your boot media
    6. Test: Your script will launch before LiteTouch.wsf

    Here's an example of what a stock Unattend_PE_x64.xml file looks like:

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>32</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
                <RunSynchronous>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>1</Order>
                        <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
            </component>
        </settings>
    </unattend>


    Here is my modified version that executes a script prior to running LiteTouch.wsf.
    The areas in bold are the areas that require changes.

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>32</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
                <RunSynchronous>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>1</Order>
                        <Path>wscript.exe X:\Path\To\Custom\Scripts.wsf</Path>
                    </RunSynchronousCommand>
                    <RunSynchronousCommand wcm:action="add">
                        <Description>Lite Touch PE</Description>
                        <Order>2</Order>
                        <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>
                    </RunSynchronousCommand>
                </RunSynchronous>
            </component>
        </settings>
    </unattend>


    In my example, I'm referencing another .WSF but it could be .VBS, .BAT. CMD etc..


    Any time you update the deployment share, regenerate your media, it'll have that change as long as it is performed on a machine that has the updated .XML template!




    Wednesday, May 27, 2015 4:33 PM
  • Thanks everybody, I will try your solution!
    Wednesday, May 27, 2015 5:11 PM