# Thursday, October 02, 2008

Today I was attempting to create a sysprep.xml file for Windows 2008. After opening my WIM file in Windows SIM I got the prompt to generate a Catalog file, clicked Yes and then......Error!! What?? Lets try that again....Error!! Whatever, lets try again, Error!! Ok this time I read the error. "System.Reflection.TargetParameterCountException: Parameter count mismatch." Ummm, what??

After wasting almost 2 hours chasing this error I found this post on the TechNet Forums: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3066853&SiteID=17.

The key information is:

Because of the changes in the servicing stack in Windows Vista with Service Pack 1 (SP1) and Windows Server 2008, Windows System Image Manager (Windows SIM) cannot create catalog files for some Windows images of different architecture types. The following list describes the Image Manager architecture types and catalogs that can be created for each one.

x86 Windows SIM:
Can create catalogs for x86, x64, and Itanium-based Windows images.

x64 Windows SIM:
Can create catalogs only for x64 Windows images.

Itanium-based Windows SIM:
Can create catalogs only for Itanium-based Windows images. 

Please confirm if what version of Windows SIM you are using. I recommend installing x86 Windows SIM.

Hope it helps.

Tim Quan - MSFT

Update: Michael Niehaus pointed out that this information is available in the updated version of the WAIK 1.1 release notes available at http://www.microsoft.com/downloads/details.aspx?FamilyID=051091e8-51ea-4d2c-96b3-dc9863edebd9&displaylang=en.

posted on Thursday, October 02, 2008 11:12:33 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [2]
# Sunday, June 22, 2008

I'm not sure how I missed this one or how long it has been available but you can download the source code for MDT 2008 from Microsoft Download. You can learn a lot about how MDT 2008 works and also a lot about managed MMC snap-ins from the MDT 2008 source code. Click here to download.

posted on Sunday, June 22, 2008 10:18:04 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0]
# Tuesday, June 17, 2008

I spotted an article on Micheal Niehaus' blog the other day about moving to a single partition when doing OS deployments. You can read the article here.

This very issue arose in the project I am currently involved in and after trying reading and implementing Micheal's post I found a couple of nuances:

  • If there is an OEM partition (like WinRE) then you risk deleting you're OS partition. OEM partitions are often a hidden partition (Type 0x27) at the start of the disk that allow OEM's to offer a recovery environment for their customers.
  • If there is more than a one extra partition on the disk then ExtendOemPartition=1 won't really work.

I thought the problem deserved some more attention so I've written a script to be included in the "Refresh only" section of "Preinstall" in the Task Sequence that you use to deploy you're image. The script queries WMI to find how many partition are on the disk that contains C:. If there are any partitions after the C: partition they are removed using diskpart "delete partition".

Any comments or suggestions please let me know!

posted on Tuesday, June 17, 2008 2:26:12 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0]
# Wednesday, May 28, 2008

So once you've created a Distribution share with MDT at some point you're going to need a LAB Deployment point. Creating and updating Deployment Points is managed via [Microsoft.BDD.ConfigManager.Manager] in Microsoft.BDD.ConfigManager.dll.

To get stared you need need a DeployManager:
[System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.ConfigManager.dll") | Out-Null
$manager = [Microsoft.BDD.ConfigManager.Manager]
$deployManager = $manager::DeployManager

Once you've got a DeployManager you can create a new deployment point using CreateNew(). This returns a generic deployment point which you can then specify what type and settings you need for the deployment point. Specifying the type and settings (ie. all the options on the General, Rules, WinPE tabs) is done by setting some properties on the deployment point object like so:

$deploymentPoint = $deployManager.CreateNew()
$deploymentPoint["Name"] = "LAB"
$deploymentPoint["Type"] = "LAB"
$deploymentPoint["NetworkShare"] = $NetworkShare
$deploymentPoint
["LocalSharePath"] = $LocalSharePath
$deploymentPoint
["GenerateLiteTouchISO"] = $true
$deploymentPoint["GenerateLiteTouchFlatISO"] = $false
$deploymentPoint["GenerateGenericISO"] = $false
$deploymentPoint["GenerateGenericFlatISO"] = $false

This is not a complete list of properties but it gives you the right idea. Once you have a deployment point you also need to specify which Applications, Task Sequences and Driver Groups you wish to include. For a LAB deployment point this is all of them:

$applicationRow = $deploymentPoint.CreateNewChild("Application")
$applicationRow["Application_Column"] = "*"
$deploymentPoint.AppendChild("Application", $applicationRow)

$taskSequenceRow = $deploymentPoint.CreateNewChild("TaskSequence")
$taskSequenceRow["TaskSequence_Column"] = "*"
$deploymentPoint.AppendChild("TaskSequence", $taskSequenceRow)

$driverGroupRow = $deploymentPoint.CreateNewChild("DriverGroup")
$driverGroupRow["DriverGroup_Column"] = "*"
$deploymentPoint.AppendChild("DriverGroup", $driverGroupRow)

After we've made all the changes we want you need to commit all the changes:
$deploymentPoint.Update()

The other really nice part about using MDT from powershell is the Bootstrap and CustomSettings writers that are built in. For example, if I want to add some lines to Bootstrap and CustomSettings.ini for the deployment point I've just created:

#Update the Bootstrap.ini file
$deploymentPoint.Bootstrap.Write("Default", "DeployRoot", $NetworkShare)
$deploymentPoint
.Bootstrap.Write("Default", "KeyboardLocale", "en-AU")
$deploymentPoint
.Bootstrap.Write("Default", "SkipBDDWelcome", "YES")

#Write Some default values to the CustomSettings.ini file
$csIni = $deploymentPoint.CustomSettings
$csIni.Write("Default", "_SMSTSORGNAME", "Windows XP Build Process")
$csIni.Write("Default", "UserDomain", "LAB")
$csIni.Write("Default", "KeyboardLocale", "en-AU")
$csIni.Write("Default", "SkipBDDWelcome", "YES")

For an end-to-end example have a look at Create-LABDeploymentPoint.zip (1.4 KB). This script sets up a lab deployment point and sets a bunch of settings that I use for XP deployments. If you want to test it out without breaking your existing LAB deployment point change line 23 to LAB_TEST.

posted on Wednesday, May 28, 2008 10:48:43 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0]
# Tuesday, April 29, 2008

I've been playing with automating MDT 2008 using Powershell and thought I'd start to share some of the info over the next few weeks.

The very first thing you need to do in MDT is create a Distribution Share. It turns out this is exceptionally easy in Powershell. The Microsoft.BDD.ConfigManager.Manager namespace has a method called UpgradeDistributionShare(string location, bool update). Just pass in the location you'd like to create the distribution share at and you're done! You can set update to true if you are upgrading an existing Distribution Share to MDT 2008.

Here is the code:

Param
(
   [
string]$Location =$(throw "You must specify a Location")
)

#Initialize MDT
[System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.ConfigManager.dll") | Out-Null
$manager = [Microsoft.BDD.ConfigManager.Manager]

#Create a new MDT Distribution Share
$manager::UpgradeDistributionShare($Location, $false)

posted on Tuesday, April 29, 2008 1:36:55 PM (E. Australia Standard Time, UTC+10:00)  #    Comments [0]