locked
Using an IF statement in the CustomSetting.ini for sysPrep & Capture RRS feed

  • Question

  • Hey peepz,

    rather than // commenting out a couple lines when i want to sysprep/capture a machine, is it possible to use an IF statement in the file to check what the taskSequence ID is. or at least another way to achieve what i am after??

    say 

    IF taskSequence != win7-x64-capture
    JoinDomain=blahblah
    MachineObject=OU=OU=Computers, DC=blahblah
    END-IF

    basically need to remove the JoinDomain line so the Capture Image task sequence works when running only that task sequence.

    Thanks,

    Dave.


    • Edited by VeggieDave Monday, May 2, 2016 5:32 AM
    Monday, May 2, 2016 12:59 AM

Answers

  • I am not certain if IF statements can be used in customsettings.ini but there are a number of ways you can accomplish what you are trying to do.  One would be to create the task variables in the task sequence instead of in customsettings.ini.  But if you are set on doing it in customsettings.ini you could do something like this:

    [Settings]

    Priority=TaskSequenceID,Default

    [<first task sequence id>]

    JoinDomain=blahblah
    MachineObjectOU=OU=Computers, DC=blahblah

    [win7-64-capture]

    [Default]

    Remember, we are using task sequence ID NOT task sequence Name.  I did not include any variables under [win7-64-capture] as they did not appear to be needed.  Also, I assumed you mistyped the MachineObjectOU variable. 

    • Marked as answer by VeggieDave Tuesday, June 14, 2016 10:14 PM
    Monday, May 2, 2016 2:32 PM

All replies

  • I am not certain if IF statements can be used in customsettings.ini but there are a number of ways you can accomplish what you are trying to do.  One would be to create the task variables in the task sequence instead of in customsettings.ini.  But if you are set on doing it in customsettings.ini you could do something like this:

    [Settings]

    Priority=TaskSequenceID,Default

    [<first task sequence id>]

    JoinDomain=blahblah
    MachineObjectOU=OU=Computers, DC=blahblah

    [win7-64-capture]

    [Default]

    Remember, we are using task sequence ID NOT task sequence Name.  I did not include any variables under [win7-64-capture] as they did not appear to be needed.  Also, I assumed you mistyped the MachineObjectOU variable. 

    • Marked as answer by VeggieDave Tuesday, June 14, 2016 10:14 PM
    Monday, May 2, 2016 2:32 PM
  • How do most people deal with this situation when you sysPrep a machine??

    i'm not set on using the CustomSetting.ini and it seems very limiting to achieve this.

    in the taskSequence, can simply add "Set a task Sequence Variable" in PreInstall??
    Then add "JoinDomain" as Variable & "BlahBlah" as a value??

    Tuesday, May 3, 2016 5:08 AM
  • Customsettings is what most people would use to achieve what you're looking for.  When MDT processes rules, it'll read the tasksequence ID and process the logic similar to what you're looking for above.  Anything under the [win7-64-capture] would automatically be taken up at deployment when running that task sequence, including things like the OU and domain join properties.  Setting it in the task sequence itself is going to make it harder to manage versus going into the customsettings and just adjusting your properties for that deployment.
    Tuesday, May 3, 2016 5:21 AM
  • Hello VeggieDave

    What I have found to be helpful is to have a separate deployment share for my operating system source files and capture task sequences. Then a separate deployment share for the custom deployment task sequences. That way they each have their own customsettings.ini dedicated to a specific purpose (capturing or deploying).

    Regards,

    Darren

    Tuesday, May 3, 2016 8:49 PM
  • so is it possible to have just one line of code that can point to multiple TaskSequenceID's?

    [win7-X64, WIN7-X32]  ??

    more just for less lines of code?
    The above suggested code does work, just needs multi lines of the same code for each TaskSequenceID.

    EDIT:

    I also had to edit the DeployWiz_SelectTS.vbs  and add a few lines of code. 
    Also had the Edited each task to process rules and gather settings pointing to CustomSettting.INI

    Thanks.


    • Edited by VeggieDave Wednesday, May 11, 2016 11:41 PM
    Wednesday, May 11, 2016 11:08 PM