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: http://blogs.technet.com/b/mniehaus/archive/2009/05/15/manipulating-the-microsoft-deployment-toolkit-database-using-powershell.aspx

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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s