How can I present a dynamic OU Selection prompt for MDT/SCCM?

By | December 18, 2014
Share

First thing you will need to installf Maik Koster’s “Deployment Webservice“. This will give you the ability to do cool stuff like query AD for a list of OUs, or move computers around to different OUs, and add/remove computers from SCCM collections. Any many other actions similar to that.

Once you have it installed and working, use the ad.asmx page to verify the GetOUs service functions.

Create a new package containing INI files for each action you wish to perform from your task sequence.

Here are my GetOUs examples:

My GetOUs.ini file:

 

  • I am creating the Path() list variable to store all of the returned Path elements.
  • I then set the two required input arguments; ParentPath and Level.

To test that it works, I added a pause step to my MDT Deployment Task Sequence.

My Pause Script:

MsgBox “OK”

Then I copied a Gather step and changed the package to my newly created package containing MyGetOUs.ini.

In the “Rules files” field, I enter the full name of my INI file.

  • Note: Gather steps must occur after a “Use Toolkit Package” step, because this step copies the MDT scripts local which are utilized during the Web Service calls.
  • Place the GetOUs web service call before the pause, so you can review the ZTIGather.log output to ensure the PATH variable is populated.

Next we need to prompt the user with the captured OUs. For this, I used a Powershell script. So I first needed to add Powershell to my WinPE Boot Image.

Last, I added a package with my Powershell script. I do not add a program, because I’m going to call the script via a Run a Command Line step.

Here is the script contents:

This script populates a TS variable named OUPath, which I use at the end of the Task Sequence calling a web service to move the computer to the selected OU. I perform the move at the end, to avoid having GPO settings interfere with my Task Sequence.

 

/Brian Gonzalez

2 thoughts on “How can I present a dynamic OU Selection prompt for MDT/SCCM?

  1. Simon B

    Hi
    Out of interest, what are you physically entering for the ParentPath and level? I ask because most of the services are working but for some reason I can’t get this one working for some reason (GetOUs). Could do with an example.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*