MDT2013 – Powershell ‘BESERK’ mode, configure everything with Powershell!!!

Very recently, deploymentreseach’ Johan Arwidmark, blogged about configuring your DeploymentShare properties (which are saved in .\Control\Settings.xml) with Powershell.

Some time ago I started working on some Powershell scripts myself, mostly oriented on configuring the bootstrap.ini and customsettings.ini, and creating some folders within the MDT Workbench.

While I never had gotten the time and energy to finish it, Johan’s blog basically pushed me over the edge, and then it happened… I went BESERK /cannot compute 😛

beserk

The result you can find in the following script which not only configures your deployment share properties, but also configures:

  • Bootstrap.ini
  • CustomSettings.ini
  • Modifies “.\Scripts\Litetouch.wsf” to use the _SMSTSPackageName variable
  • Configure DeploymentShare Properties
  • Creates a folderstructure within MDT
  • Creates selection profiles within MDT

The script! Updated @ 2014-03-20

Basically this script can be divided into five pieces:

1. Constants

The constants that I have declared are the variables that represent the value that is shown, by modifying these values, you can customize and personalize this script for your own purposes. This script is primarily intended for new to be configured deployment environments, so keep in mind that using this script on existing environments will overwrite all content within the bootstrap.ini and customsettings.ini!

2. Configuring Bootstrap.ini and Customsettings.ini

Basically I use a multiline string for both my Bootstrap.ini and CustomSettings.ini and within that line of code, on certain places I call my variables. This way the variables will be used for input, instead of having to change a server name every single time on every single row of code.

3. Configuring the DeploymentShare properties

This part we already know from Johan / deploymentreseach, however I’ve took the liberty to customize it to my wishes, and fully write out all the available settings in .\Control\Settings.xml

4. Configure a logical folderstructure within the MDT Workbench

This part is quite new, I now know again thanks to Johan and Roger the Young a PSDrive can be browsed from a powershell command prompt, just type: dir ds001: and you can actually see and browse the MDT Workbench ‘folder structure’.

figure 1.1: Browse PSdrive

psdrive

If you want to browse any further, just type dir DS001:\Applications or “DS001:\Operating Systems” (note that if you use spaces in your folders, you need to use quotes “”)

5. Configure selection profiles for Driver and Packages selection

The last thing I wanted to do is configure pre-configured selection profiles which can be uses for injecting certain drivers, targeting packages, creating media etc.

What has changed since 2014-03-20

The script needed some simplification to avoid having to enter the same values at different places. Also now the script creates an entire deployment share for you. So now there is no need to create an deploymentshare with MDT before executing this script. Lastly the ZTIDiskpart.wsf will be modified to calculate with binary metrics. So a 100 Gb disk partition specified will actually end up as an 100 Gb disk partition instead of 98,7 Gb.

Closing

Is this the right way to do it, I have no clue, what I do know is that I never want to configure a deploymentshare manually ever again, so this script definitely helps me. Also, adjusting the values of the constants declared is a fraction of the effort I have to put in vs. going through “Create folder” wizards for the 50th time.

Special thanks go out to scripting wizard Roger the Young a.k.a. “DrillSergeant” and Johan Arwidmark, for giving me renewed inspiration to continue to develop this script in what it has become.

ps I. forgive my powershell language, using words as constants, variables, properties and values, are perhaps not used in the correct way! -im still trying 🙂

ps II. also I can imagine this script can be simplified drastically, and I don’t mind if you do, as long as you share it back with me, like I shared it here with you 😀 Or as the Germans say: “wiedersehen macht freude”

Finally, you can download the script here:

zip
ConfigureDeploymentShare.zip

 

5 thoughts on “MDT2013 – Powershell ‘BESERK’ mode, configure everything with Powershell!!!

  1. Marc

    Hi Rens,

    Just tried out this scrip and noticed a few things.
    1. Even though I edited the MachineObjectOU path, you were missing a , after the last OU and first DC. [LINE 57]
    2. The script didn’t place the text for CustomSettings.ini into the actual file but rather pasted it into the Bootstrap.ini. I THINK this was because the “@ was right after YES [LINE 79] but should have been placed on a new line.
    3. The settings for Hyper-V and VMware for OSDComputerName and JoinWorkgroup are swapped. I’m guessing Hyper-V has the correct settings being OSBUILD and WORKGROUP whereas VMware had $JoinWorkgroup for ComputerName and BUILD for JoinWorkgroup. [LINE 91-91 & 104-105]

    Other than that, looks great!

     
    Reply
    1. Rens Hollanders

      Hi Marc,

      I’ve never encountered any errors running my script, however I see now the script pasted in the script box on my website differs from the actual script attached in the zip file. With the remarks you’ve commented. I’ll update it right away. The script attached in the zip file should be free from those errors.

      Thank you for your vigilance 🙂

      Cheers! Rens

       
      Reply
  2. GraceSolutions

    Hey there Rens! Nice post! Are you active in the community? I have a script that will really help, but it could a second set of eyes.

     
    Reply
    1. Rens Hollanders

      Hi, I used to be. Currently my status is a bit idle unfortunately, but hey I’m willing to help and curious to what you are up to.

      Cheers! Rens

       
      Reply
  3. Carl

    Very helpful! I’ve tweaked it for my environment, and one thing that works for me is to use this instead of a fixed Sleep time after creating the share:

    while ( ( Get-PSDrive | where Path -eq $UNCPath ).IsSaving ) { Start-Sleep -s 1 }

     
    Reply

Leave a Reply

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