Save time (and avoid pain) – Create a MDT simulation environment

This is an update to an old post, but this time using PowerShell instead of VB Script. Anyway, by adding a few files to a folder you can simulate the gather process of MDT, and figure out why settings fails in seconds rather than hours… Create a MDT simulation environment – here is how:

Update July 30, 2014: You also might want to look into this post about creating a MDT simulation environment for your PowerShell scripts: http://www.osd-couture.com/2014/07/mdt-2013-create-simulation-environment.html

Prerequisites

This guide assumes you have an existing MDT Lite Touch Deployment Share (meaning MDT and ADK installed)

Step-by-step instructions

  1. On a machine in the domain, install the ConfigMgr 2012 R2+ Toolkit to the default location, navigate to C:\Program Files (x86)\ConfigMgr 2012 Toolkit R2\ClientTools, then start CMTrace and click Yes to associate .log files with it.

    image 
    The CMTrace dialog box when started the first time.

  2. Create a folder named C:\MDT and copy the following files from your deployment share, Scripts folder to C:\MDT.

    ZTIDataAccess.vbs
    ZTIGather.wsf
    ZTIGather.xml
    ZTIUtility.vbs Note:
    If you are using any userexit scripts, like the modelaliasexit.vbs script, copy that script to the C:\MDT folder as well (Thanks Gebray1s for pointing that out).  

  3. Copy/Create the CustomSettings.ini file you want to test to C:\MDT.
  4. In the C:\MDT folder, create a subfolder named x64.
  5. From your deployment share, Tools\x64 folder, Copy Microsoft.BDD.Utility.dll to C:\MDT\x64.
  6. Create a PowerShell script named Gather.ps1 with the following information:   
# Check for elevation
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
    [Security.Principal.WindowsBuiltInRole] "Administrator"))
{
    Write-Warning "Oupps, you need to run this script from an elevated PowerShell prompt!`nPlease start the PowerShell prompt as an Administrator and re-run the script."
    Write-Warning "Aborting script..."
    Break
}

cls
if (Test-Path -Path "C:\MININT") {Write-Host "C:\MININT exists, deleting...";Remove-Item C:\MININT -Recurse}
cscript.exe ZTIGather.wsf /debug:true

# Optional, comment out if you want the script to open the log in CMTrace
& "C:\MDT\CMTrace" C:\MININT\SMSOSD\OSDLOGS\ZTIGather.log

The C:\MDT Folder

By now your C:\MDT folder should look like this:

MDT

The C:\MDT folder after adding all needed files (again, if using any userexit scripts, add them as well)

Sample CustomSettings.ini file

In the below sample I have the following customsettings.ini file

[Settings]
Priority=Model, Default

[Default]
OSInstall=YES

[HP EliteBook 8570w]
MandatoryApplications001={980fc0ac-68eb-4227-bc57-49ac352e18d5}

Running the simulation

1. Open an elevated PowerShell prompt, and navigate to C:\MDT,

2 Run the Gather.ps1 script (the console will look like this):

image

The ZTIGather.log will look like this:

image

From the above log file we can see that if I would have deployed a HP Elitebook 8570w, it would actually install an application with the guid of {980fc0ac-68eb-4227-bc57-49ac352e18d5}. If I check the Deployment Workbench, I can see which application that has that guid.

/ Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
15 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Admin
Admin
8 years ago

The simulation process only rules, but you can like a "init" section in where you hardcode a specific TaskSequenceID, and then the following rules will use that info

/ Johan

tonymarciano
tonymarciano
8 years ago

And just to be more specific, really I am looking to make sure that driver injection is getting picked up correctly in cs.ini. I would think that's where something like emulation would be most useful since that's the area where MDT noobies like myself are likely to falter. Thanks Johan.

tonymarciano
tonymarciano
8 years ago

Question Johan, I have priority=TaskSequenceID, Default in my customsettings.ini. I have 3 different deployment types with the TSIDs in my cs.ini. I'm guessing there's no way to simulate the deployment so that I can see those properties get processed for these task sequences? Right now it skips right to default using the method described in this thread.

Diagg
Diagg
9 years ago

Muchas gracias !!!

Admin
Admin
9 years ago

Hi Diagg,

Great tip, thanks for sharing… I added a link to it in the post.

/ Johan

Diagg
Diagg
9 years ago

In case someone care, i've just ported the solution to full powershell, meaning access to Tsenv & TsenvList… http://www.osd-couture.com/2014/07/mdt-2013-create-simulation-environment.html

Lopan
Lopan
9 years ago

ok, Got it working with SCCM w/ MDT integration… so that would be a yes.
Thank you for putting this together

Lopan
Lopan
9 years ago

Does this process work properly with Configuration manager? Any limitations?

jonconwayuk
jonconwayuk
9 years ago

Many thanks Johan 🙂

Admin
Admin
9 years ago

The PowerShell editor I use 99 percent of the time is ISE, but if your refer to the PowerShell scripts I posted in the blog, they are "encoded/displayed" with the "PreCode Snippet" plugin to Live Writer.

/ Johan

jonconwayuk
jonconwayuk
9 years ago

Thanks – it was just the editor for the PowerShell script I was interested in. I've seen you use it before (I'm not a stalker btw..) and just liked the formatting colours it uses 🙂

Admin
Admin
9 years ago

I'm using Windows Live Writer for the posts if that's what you mean?

/ Johan

jonconwayuk
jonconwayuk
9 years ago

Bit of an unrelated question but which text editor is being used in the screenshots?

Admin
Admin
9 years ago

Yep, that's right, added a note to the post about that. Thanks!

/ Johan

Graeme
Graeme
9 years ago

Great tip. One other thing to note…

If you are testing your customsettings.ini that you are having issues with, be sure to include any UserExit scripts you have. When I first started testing my CS.ini, I kept getting failures and not my expected result. I copied "ZTITheUserExit.vbs" over, voila, issues resolved.


>