MDT 2010 – Using The Database And Powershell To Enhance Administration

It is possible to build some automation into your MDT environment firstly by using the Advanced Configuration available and configuring a database (SQL Express for instance to keep costs down), and secondly start manipulating this database with powershell to create bulk-actions, populations, record changes etc etc…

First place to start is with Michael Niehaus. Back in 2009 Michael published this powershell module for use with MDT: Read about the cmdlets and download the module here:

Once you’ve downloaded and saved the psm1, open powerhell and set the execution policy to unrestricted: “set-executionpolicy unrestricted” and accept the warning:

Now import the psm1 module by typing “import-module %pathtoscript%\MDTDB.psm1 -verbose”

First task is to connect to the MDT database, using the Connect-MDTDatabase cmdlet. Use “get-help connect-mdtdatabase” to check the syntax but it’s basically:

“Connect-MDTDatabase -SQLServer ServerName -Instance InstanceName -Database DatabaseName

Then you’re ready to go.

Useful cmdlets: Get-MDTComputer, New-MDTComputer, Set-MDTComputer

Try using a csv, and an import-csv cmdlet to bulk populate your database with computers:

New-MDTComputer –macAddress MACAddress –settings @{OSInstall=’YES’}

The first thing I wanted to do after populating was control which computers could be installed via F12. I set the OSINSTALL attribute in the Default Section of CustomSettings.ini to OSINSTALL=NO and set the priority of Default to last.

Then I used Get-MDTComputer | Set-MDTComputer -Settings @{OSINSTALL=’YES’} to allow all machines to build.

Once they were built, it was easy to use Get-MDTComputer | Set-MDTComputer -Settings @{OSINSTALL=”} to stop them from being able to rebuild should someone decide they wanted to do so without authorisation.


MDT 2010 Update 1 Quick Start

My latest customer does not have requirements at the moment for SCCM, or funds or resources because it is a school with a tight IT budget.

So to roll-out new operating system images i’ve established a server and installed MDT 2010 Update 1.

Here is a quick start guide for MDT with a SQL database.

1. Build servers, or domain infrastructure. I am using a SQL Server 2008 R2 server for the MDT database.

2. Build a server operating system for MDT

3. Install WDS

3.1 Configure WDS – Plenty of resources on the internet about how to do this, i am concentrating here on the final steps of MDT setup, but don’t worry too much about images at this stage as we will replace them later; install the default boot image and configure the PXE response and Boot settings. Configure DHCP according to your environment.

4. Install WAIK It is a huge download

5. Install MDT

6. Configure MDT

6.1 Create Deployment Share

6.2 Add Operating System Image(s) – from source DVD or pre-captured WIM image

6.3 Create New Database in Advanced Configuration

6.3.1 Give the SQL server name, instance and database name

6.3.2 Define the SQL DeploymentShare, this allows the LiteTouch account to authenticate against the SQL Server. When you define this path, make sure the path exists on the SQL Server, this is important.

6.3.3 You can configure the database rules at this stage, it modifies the INI file on the MDT server rather than the database itself.

6.3.4 Configure the bootstrap.ini to include account credentials for connecting to the database.

6.4 Create Simple Task Sequence

That’s it, not a lot of detail i know but i will post next time with pictures and all that kind of stuff. The most important things to remember are 6.3.2 and 6.3.4 – without these settings configured you will get ZTI errors trying to authenticate to SQL in the OSD log.

Now go ahead and add a computer account to the database, and you open up much more flexibillity in MDT, allowing you to deploy to numerous machines with customisable settings.