locked
Modifying LiteTouch.wsf RRS feed

  • Question

  • I need to modify a registry value for a NIC prior to a system retrying a to connect back to the server after the first reboot. 

    Should I modify the Litetouch.wsf file to do this? If so, where can I add this VB script in that file?

    const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "."

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
    strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007"
    oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"*PriorityVLANTag", 0


    Friday, May 1, 2015 3:01 PM

Answers

  • I would create a runonce in the unattend.xml and put priority on it before Litetouch.wsf under oobeSystem\FirstLogonCommands.  You can have it run your script first and then run litetouch.wsf.  You can even follow MDT's example with litetouch in that step and emulate what it's doing to also call your script. Hope this helps!

    Ryan


    • Edited by MrBrooks Friday, May 1, 2015 5:40 PM
    • Marked as answer by lunarpowered Friday, May 1, 2015 6:04 PM
    • Unmarked as answer by lunarpowered Friday, May 1, 2015 6:04 PM
    • Marked as answer by lunarpowered Friday, May 1, 2015 6:18 PM
    Friday, May 1, 2015 5:39 PM

All replies

  • I would create a runonce in the unattend.xml and put priority on it before Litetouch.wsf under oobeSystem\FirstLogonCommands.  You can have it run your script first and then run litetouch.wsf.  You can even follow MDT's example with litetouch in that step and emulate what it's doing to also call your script. Hope this helps!

    Ryan


    • Edited by MrBrooks Friday, May 1, 2015 5:40 PM
    • Marked as answer by lunarpowered Friday, May 1, 2015 6:04 PM
    • Unmarked as answer by lunarpowered Friday, May 1, 2015 6:04 PM
    • Marked as answer by lunarpowered Friday, May 1, 2015 6:18 PM
    Friday, May 1, 2015 5:39 PM
  • Yeah, do all you can to keep from editing the original scripts. If you update MDT, your work will be wiped out and if you didn't document what you did you might be in trouble.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, May 1, 2015 5:50 PM
  • Thank you for the reply.

    I've updated to this:

                <FirstLogonCommands>
                    <SynchronousCommand wcm:action="add">
                        <CommandLine>wscript.exe %SystemDrive%\set_priority_vlan.vbs</CommandLine>
                        <Description>Set Priority VLAN</Description>
                        <Order>1</Order>
                    </SynchronousCommand>
                    <SynchronousCommand wcm:action="add">
                        <CommandLine>wscript.exe %SystemDrive%\LTIBootstrap.vbs</CommandLine>
                        <Description>Lite Touch new OS</Description>
                        <Order>2</Order>
                    </SynchronousCommand>
                </FirstLogonCommands>

    Would I be able to use MDT variables such as %SCRIPTROOT% instead of %SystemDrive%?

    Friday, May 1, 2015 6:00 PM
  • In your script you could have something like

    <job id="Run-CustomApp">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 

    By referencing the ZTIUtility you can then make use of MDT variables inside your script. But the unattend file itself won't process a MDT variable.


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Friday, May 1, 2015 6:14 PM
  • Thanks again for the response. Maybe I'm asking the wrong question. 

    How can I execute the .vbs file if it is not already on the image?

    Friday, May 1, 2015 6:20 PM
  • Your script has to come from somewhere.  If you can't reach the deployment share because your drivers are not installed yet, then you need to bake it into the image.  I would recommend an admin secure location and wipe directory at the end of deployment.
    Friday, May 1, 2015 6:24 PM
  • Ah, good point. I wonder if this would work:

    <FirstLogonCommands>
                    <SynchronousCommand wcm:action="add">
                        <CommandLine>REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007 /v *PriorityVLANTag /t REG_SZ /d 0</CommandLine>
                        <Description>Set Priority VLAN</Description>
                        <Order>1</Order>
                    </SynchronousCommand>
                    <SynchronousCommand wcm:action="add">
                        <CommandLine>wscript.exe %SystemDrive%\LTIBootstrap.vbs</CommandLine>
                        <Description>Lite Touch new OS</Description>
                        <Order>2</Order>
                    </SynchronousCommand>
                </FirstLogonCommands>
    Friday, May 1, 2015 6:36 PM
  • It worked, but it prompts to overwrite the key because it already existed. Will look into it more. Thanks for everyone's help. 

    Switch is /f to force.

    Friday, May 1, 2015 7:14 PM