Michael Niehaus' Windows and Office deployment ramblings
Quite some time ago (well over a year ago – time flies) I posted a script at http://blogs.technet.com/mniehaus/archive/2008/06/20/sorting-mdt-s-lists-of-applications-task-sequences-patches-etc.aspx that described how to sort the content in an MDT 2008 distribution share. Now that MDT 2010 has been released, it’s important to first point out that this script will not work with MDT 2010 for a variety of reasons.
Since MDT 2010 has the same behavior, showing the items in the order that they were added in Workbench, that means you are now in need of a new script. Fortunately, this isn’t too hard to do using a PowerShell script (and a little bit of knowledge of the underlying workings of the MDT 2010 PowerShell provider). Here’s the script (also attached in a Zip file for those interested in a simpler download):
# *************************************************************************** # # File: DeploymentShareSorter.ps1 # # Author: Michael Niehaus # # Purpose: This PowerShell script will sort the existing files and folders # in a deployment share. # # Note that there should be no one actively adding items to the # deployment share while running this script, as some of the # operations performed could cause these items to be lost. # # This requires PowerShell 2.0 CTP3 or later. # # Usage: Copy this file to an appropriate location. Edit the file to # change the $rootPath variable below, pointing to your # deployment share. (This can be a local path or a UNC path.) # # ------------- DISCLAIMER -------------------------------------------------- # This script code is provided as is with no guarantee or warranty concerning # the usability or impact on systems and may be used, distributed, and # modified in any way provided the parties agree and acknowledge the # Microsoft or Microsoft Partners have neither accountability or # responsibility for results produced by use of this script. # # Microsoft will not provide any support through any means. # ------------- DISCLAIMER -------------------------------------------------- # # *************************************************************************** # Constants $rootPath = "\\mniehaus-t61p-7\DeploymentShare$" # Conect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue New-PSDrive -Name DeploymentPointSorter -PSProvider MDTProvider -Root "$rootPath" # Functions function Sort-MDTFolderItems { [CmdletBinding()] PARAM ( [Parameter(Position=1, ValueFromPipeline=$true)] $folder ) Process { Write-Host "Sort-MDTFolderItems: Processing folder $($folder.Name)" # Initialize the sorted array $sorted = @() # Get the list of immediate subfolders, sort by name, and add to the array $folderPath = $folder.PSPath.Substring($folder.PSPath.IndexOf("::")+2) Get-ChildItem $folderPath | ? {-not $_.PSIsContainer} | Sort Name | % { $sorted += $_.Guid } # If there were any items found, process them. if ($sorted.Count -gt 0) { # See if the list is already sorted. If it is, we don't need to make any updates. $compareResults = compare-object $sorted $folder.Item("Member") -SyncWindow 0 if ($compareResults -eq $null) { Write-Host "Already sorted." } else { Write-Host "Saving sorted list." # First remove all members of the list because the PowerShell provider will "optimize" the change by seeing there # were no items added or removed. Then put all the members back in the sorted order. (This is actually quite # dangerous to do as it could orphan the items, so we need to immediately put them back.) $folder.Item("Member") = @() $folder.Item("Member") = $sorted } } } } function Sort-MDTFolderSubfolders { [CmdletBinding()] PARAM ( [Parameter(Position=1, ValueFromPipeline=$true)] $folder ) Process { Write-Host "Sort-MDTFolderSubfolders: Processing folder $($folder.Name)" # Initialize the arrays $sorted = @() $unsorted = @() # Get the list of immediate child folders, sorted and unsorted $folderPath = $folder.PSPath.Substring($folder.PSPath.IndexOf("::")+2) $folderList = Get-ChildItem $folderPath | ? {$_.PSIsContainer} $folderList | % { $unsorted += $_.Name } $folderList | Sort Name | % { $sorted += $_.Name } # If there were any subfolders found, process them. if ($sorted.Count -gt 0) { # See if the list is already sorted. If it is, we don't need to make any updates. $compareResults = compare-object $sorted $unsorted -SyncWindow 0 if ($compareResults -eq $null) { Write-Host "Already sorted." } else { Write-Host "Sorting folders." # Create the temporary folder $null = New-Item "$folderPath\__TEMP__" -ItemType Folder # Move the folders into the temporary folder $sorted | % { Move-Item "$folderPath\$_" "$folderPath\__TEMP__" } # Move the folders back $sorted | % { Move-Item "$folderPath\__TEMP__\$_" "$folderPath" } # Remove the temporary folder Remove-Item "$folderPath\__TEMP__" } } } } # Enumerate the folders and call the functions above to process each one Get-ChildItem DeploymentPointSorter: -Recurse | ? {$_.PSIsContainer} | Sort-MDTFolderItems Get-ChildItem DeploymentPointSorter: -Recurse | ? {$_.PSIsContainer} | Sort-MDTFolderSubfolders
# *************************************************************************** # # File: DeploymentShareSorter.ps1 # # Author: Michael Niehaus # # Purpose: This PowerShell script will sort the existing files and folders # in a deployment share. # # Note that there should be no one actively adding items to the # deployment share while running this script, as some of the # operations performed could cause these items to be lost. # # This requires PowerShell 2.0 CTP3 or later. # # Usage: Copy this file to an appropriate location. Edit the file to # change the $rootPath variable below, pointing to your # deployment share. (This can be a local path or a UNC path.) # # ------------- DISCLAIMER -------------------------------------------------- # This script code is provided as is with no guarantee or warranty concerning # the usability or impact on systems and may be used, distributed, and # modified in any way provided the parties agree and acknowledge the # Microsoft or Microsoft Partners have neither accountability or # responsibility for results produced by use of this script. # # Microsoft will not provide any support through any means. # ------------- DISCLAIMER -------------------------------------------------- # # ***************************************************************************
# Constants
$rootPath = "\\mniehaus-t61p-7\DeploymentShare$"
# Conect to the deployment share
Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue New-PSDrive -Name DeploymentPointSorter -PSProvider MDTProvider -Root "$rootPath"
# Functions
function Sort-MDTFolderItems {
[CmdletBinding()] PARAM ( [Parameter(Position=1, ValueFromPipeline=$true)] $folder ) Process { Write-Host "Sort-MDTFolderItems: Processing folder $($folder.Name)" # Initialize the sorted array $sorted = @() # Get the list of immediate subfolders, sort by name, and add to the array $folderPath = $folder.PSPath.Substring($folder.PSPath.IndexOf("::")+2) Get-ChildItem $folderPath | ? {-not $_.PSIsContainer} | Sort Name | % { $sorted += $_.Guid } # If there were any items found, process them. if ($sorted.Count -gt 0) { # See if the list is already sorted. If it is, we don't need to make any updates. $compareResults = compare-object $sorted $folder.Item("Member") -SyncWindow 0 if ($compareResults -eq $null) { Write-Host "Already sorted." } else { Write-Host "Saving sorted list." # First remove all members of the list because the PowerShell provider will "optimize" the change by seeing there # were no items added or removed. Then put all the members back in the sorted order. (This is actually quite # dangerous to do as it could orphan the items, so we need to immediately put them back.) $folder.Item("Member") = @() $folder.Item("Member") = $sorted } } } }
function Sort-MDTFolderSubfolders {
[CmdletBinding()] PARAM ( [Parameter(Position=1, ValueFromPipeline=$true)] $folder ) Process { Write-Host "Sort-MDTFolderSubfolders: Processing folder $($folder.Name)" # Initialize the arrays $sorted = @() $unsorted = @() # Get the list of immediate child folders, sorted and unsorted $folderPath = $folder.PSPath.Substring($folder.PSPath.IndexOf("::")+2) $folderList = Get-ChildItem $folderPath | ? {$_.PSIsContainer} $folderList | % { $unsorted += $_.Name } $folderList | Sort Name | % { $sorted += $_.Name } # If there were any subfolders found, process them. if ($sorted.Count -gt 0) { # See if the list is already sorted. If it is, we don't need to make any updates. $compareResults = compare-object $sorted $unsorted -SyncWindow 0 if ($compareResults -eq $null) { Write-Host "Already sorted." } else { Write-Host "Sorting folders." # Create the temporary folder $null = New-Item "$folderPath\__TEMP__" -ItemType Folder # Move the folders into the temporary folder $sorted | % { Move-Item "$folderPath\$_" "$folderPath\__TEMP__" } # Move the folders back $sorted | % { Move-Item "$folderPath\__TEMP__\$_" "$folderPath" }
# Remove the temporary folder Remove-Item "$folderPath\__TEMP__" } } } }
# Enumerate the folders and call the functions above to process each one
Get-ChildItem DeploymentPointSorter: -Recurse | ? {$_.PSIsContainer} | Sort-MDTFolderItems
Get-ChildItem DeploymentPointSorter: -Recurse | ? {$_.PSIsContainer} | Sort-MDTFolderSubfolders
Save this as “DeploymentShareSorter.ps1” and you are all set. A few notes on this script:
Yes, I’ve been promising this blog posting for quite some time. And I’ve been working on this for quite some time, but kept getting distracted either by new releases (Windows 7, Windows Server 2008 R2, MDT 2010, SCVMM 2008 R2, etc.) or by the addition of new features to the PowerShell scripts that I’ve been using. But I’m determined to get this first part finished today. Shame sometime can be a motivator :-)
First you need some additional background information. I did a presentation at the Microsoft Management Summit, TechEd US, and TechEd Australia where I talked about how to use MDT 2010, ConfigMgr 2007, and SCVMM together for two main purposes:
So this posting is covering the first part, using MDT 2010 Lite Touch together with SCVMM to create an image factory. Here’s more of a logical picture of what I am talking about:
So imagine that you have created a deployment share in MDT 2010 Deployment Workbench, imported your operating systems and all the other required files, and created multiple task sequences to build your reference images. Now you want a quick and easy way to run all of those task sequences, without having a pile of hardware (so virtual machines are good) and without needing to manually initiate the process on each machine (automating the wizard). That’s where the “image factory” comes in.
To implement this, I created a set of PowerShell scripts to initiate the step-by-step process above. The scripts and their purpose:
These scripts need to know some details from your environment. Rather than hard-coding that information in the scripts themselves, this information is stored in a separate XML file named “MDTImageFactorySettings.xml.” This file contains the following settings:
So what is required to set this up in your environment? First, make sure that your environment is functional, as these scripts won’t magically fix things:
Once that’s done, you can perform the following setup steps:
You should then see that connections are made to the MDT deployment share, the MDT database (the settings for the database are retrieved from the deployment share), and the SCVMM server. A virtual machine will be created for each enabled OS deployment task sequence in the specified folder (and subfolders, recursively), and then the specified number of VMs will be started. As the first VMs complete they will shut down (as long as the task sequence finishes successfully) and new ones will be started, until all task sequences are finished.
As part of the VM creation process, new MDT database entries are created specifying the computer settings, associated to the MAC address of the network adapter for that VM. These settings include:
SkipWizard=YES SkipFinalSummary=YES TaskSequenceID=<the ID of the task sequence to run> AdminPassword=P@ssword DoCapture=YES ComputerBackupLocation=<deployment share UNC>\Captures BackupFile=<task sequence ID>.wim FinishAction=SHUTDOWN
So that specifies to skip all the wizards, run a specific task sequence, use a constant local admin password, capture an image to the deployment share using the task sequence ID to name the WIM file, and to shut down the VM when the whole process is complete.
Here’s what you might expect to see while the VMs are being created:
and while they are running:
That display will keep repeating until all task sequences are complete and the virtual machines shut down.
As the virtual machines complete, there will be two “outputs”: the WIM file that is written to the “Captures” directory of the deployment share, and the VHD file that is still attached to the VM. You can turn that VHD into an SCVMM template and use that when creating new VMs. If you do that, be sure to disconnect the ISO file from the virtual DVD drive and to configure the NIC to specify a dynamic MAC address. (More on that topic in a future blog post when we talk about virtual machine customization.)
That’s pretty much the whole process, but it is worth mentioning a few things in closing:
The “Part 2” blog posting will describe how to perform the same scenario using System Center Configuration Manager 2007 (with or without MDT), but it will take me some time to recover from this posting before I get to that one.
If I messed up the instructions or left something out, please let me know via e-mail, mniehaus@microsoft.com. The scripts attached to this blog entry are provided as-is, and are not supported by Microsoft. See the scripts for the full disclaimer.
You’ve probably gone through this cycle if you are using WDS to PXE boot computers to start bare metal Lite Touch deployments:
Fortunately, with the new “update” process in MDT 2010, described in more detail at http://blogs.technet.com/mniehaus/archive/2009/07/10/mdt-2010-new-feature-17-customizable-boot-image-process.aspx, it’s pretty simple to add a script to automate this process. First, the script:
Option Explicit Dim oShell, oEnv Set oShell = CreateObject("WScript.Shell") Set oEnv = oShell.Environment("PROCESS") If oEnv("STAGE") = "ISO" then Dim sCmd, rc sCmd = "WDSUTIL /Replace-Image /Image:""Lite Touch Windows PE (" & oEnv("PLATFORM") & ")"" /ImageType:Boot /Architecture:" & oEnv("PLATFORM") & " /ReplacementImage /ImageFile:""" & oEnv("CONTENT") & "\Sources\Boot.wim""" WScript.Echo "About to run command: " & sCmd rc = oShell.Run(sCmd, 0, true) WScript.Echo "WDSUTIL rc = " & CStr(rc) WScript.Quit 1 End if
Option Explicit
Dim oShell, oEnv
Set oShell = CreateObject("WScript.Shell") Set oEnv = oShell.Environment("PROCESS")
If oEnv("STAGE") = "ISO" then
Dim sCmd, rc
sCmd = "WDSUTIL /Replace-Image /Image:""Lite Touch Windows PE (" & oEnv("PLATFORM") & ")"" /ImageType:Boot /Architecture:" & oEnv("PLATFORM") & " /ReplacementImage /ImageFile:""" & oEnv("CONTENT") & "\Sources\Boot.wim""" WScript.Echo "About to run command: " & sCmd
rc = oShell.Run(sCmd, 0, true) WScript.Echo "WDSUTIL rc = " & CStr(rc)
WScript.Quit 1
End if
You’ll need to update the image name in the string above if you’ve changed it from the default of “Lite Touch Windows PE (x86)” and “Lite Touch Windows PE (x64)” since the script doesn’t know what you’ve changed the values to. Save the edited script as something like “C:\Scripts\UpdateExit.vbs”. Then, edit the “C:\Program Files\Microsoft Deployment Toolkit\Templates\LiteTouchPE.xml” file so that these lines:
<!-- Exits --> <Exits> <Exit>cscript.exe "%INSTALLDIR%\Samples\UpdateExit.vbs"</Exit> </Exits>
Instead look like this:
<!-- Exits --> <Exits> <Exit>cscript.exe "%INSTALLDIR%\Samples\UpdateExit.vbs"</Exit> <Exit>cscript.exe "C:\Scripts\UpdateExit.vbs"</Exit> </Exits>
Then make a change that requires re-generating the WIM and ISOs, e.g. change something in bootstrap.ini. You’ll see in the “Update Deployment Share” output the generated WDSUTIL command that updates the boot image in WDS. If WDS is located on a different server, you’ll need to update the command in the script above to add “/Server:WDSServerName” to the command. (WDSUTIL must also be available on the machine, so you may need to install the RSAT WDS tools.)
Extra credit for someone who can convert this into a PowerShell script and look up the right boot image name :-)
Both MDT 2010 Lite Touch and ConfigMgr 2007 run the same task sequencer. This task sequencer can run any command that you want, just specify the command line to use. That’s the simple part – the harder part is figuring out what this command line should do. Often the command, a VBScript or PowerShell script, needs to get information from the task sequence itself, accessing variables in the task sequence environment. Remember, these task sequence variables aren’t environment variables – they are distinctly separate, so you can’t use the PowerShell “Env:” drive.
If you are using MDT, building a VBScript that includes the ZTIUtility.vbs script makes accessing task sequence variables pretty simple, as you can then reference something like this in your script:
sValue = oEnvironment.Item("MYVAR")
But PowerShell is now the rage – what if you wanted to do the same thing using PowerShell? Fortunately that’s not too difficult either. Here’s a simple example that gets the value of a particular variable:
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment Write-Host $tsenv.Value("_SMSTSLogPath")
You would then need to set up a task sequence step that ran that PowerShell script. In the Lite Touch case, I would suggest saving the file in the “Scripts” directory on the deployment share, for example as “Test.ps1”. You could then create a “Run command line” step in the task sequence that executes this command:
PowerShell.exe -File "%SCRIPTROOT%\Test.ps1"
If you were using MDT 2010 integrated with ConfigMgr, the same thing would work, but you would need to add the file to the “Scripts” directory of the MDT toolkit package. Alternatively, you could create a new software distribution package containing the PowerShell script, specify to use that package on the “Run command line” step of the ConfigMgr task sequence, and then specify a command line that assumes the script is in the working directory:
If you want to change a task sequence variable (or set a new one), you use the same “Value” method:
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $tsenv.Value("MyVar") = "My Value"
Maybe you want to do something a little more involved, like create an transcript (log) of the execution of your script. You can use the _SMSTSLogPath variable to determine where to place the file:
# Determine where to do the logging $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $logPath = $tsenv.Value("_SMSTSLogPath") $logFile = "$logPath\$($myInvocation.MyCommand).log" # Start the logging Start-Transcript $logFile # Insert your real logic here Write-Host "We are logging to $logFile" # Stop logging Stop-Transcript
# Determine where to do the logging $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $logPath = $tsenv.Value("_SMSTSLogPath") $logFile = "$logPath\$($myInvocation.MyCommand).log"
# Start the logging Start-Transcript $logFile
# Insert your real logic here Write-Host "We are logging to $logFile"
# Stop logging Stop-Transcript
Another useful example is a script that logs the values of all task sequence variables:
# Determine where to do the logging $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $logPath = $tsenv.Value("_SMSTSLogPath") $logFile = "$logPath\$($myInvocation.MyCommand).log" # Start the logging Start-Transcript $logFile # Write all the variables and their values $tsenv.GetVariables() | % { Write-Host "$_ = $($tsenv.Value($_))" } # Stop logging Stop-Transcript
# Write all the variables and their values $tsenv.GetVariables() | % { Write-Host "$_ = $($tsenv.Value($_))" }
Or you could use the same technique to turn all the task sequence variables into PowerShell variables:
# Determine where to do the logging $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment $logPath = $tsenv.Value("_SMSTSLogPath") $logFile = "$logPath\$($myInvocation.MyCommand).log" # Start the logging Start-Transcript $logFile # Convert the task sequence variables into PowerShell variables $tsenv.GetVariables() | % { Set-Variable -Name "$_" -Value "$($tsenv.Value($_))" } # Write out a specific variable value Write-Host $_SMSTSMDataPath # Get all the variables Dir Variable: # Stop logging Stop-Transcript
# Convert the task sequence variables into PowerShell variables $tsenv.GetVariables() | % { Set-Variable -Name "$_" -Value "$($tsenv.Value($_))" }
# Write out a specific variable value Write-Host $_SMSTSMDataPath # Get all the variables Dir Variable:
(Take out all the extra stuff and this could be reduced to two lines, the one that creates the COM object and the one that calls GetVariables.)
A few other notes worth mentioning:
There are a few operations in the MDT 2010 Deployment Workbench that can take a while. We’ve done our best to optimize those processes, but in many cases they will still take a good amount of time to complete. While you could certainly start an operation in one Deployment Workbench and then open another Deployment Workbench so that you can continue working, it would be even better to schedule these long-running tasks so that they run automatically, ideally when you are sleeping and when there aren’t any active Lite Touch deployments going on.
Fortunately, since the Deployment Workbench is now PowerShell-based you can now write simple PowerShell scripts to perform these activities. The following three samples show you how to do it.
The “Update Deployment Share” process takes the latest changes made to the deployment share (bootstrap.ini updates, new drivers, new patches, script changes, etc.) and updates the Windows PE boot images (WIM files and ISOs if requested). Depending on the extent of the changes, this process might take 15-30 minutes (depending on the I/O performance of the machine – it’s definitely an I/O-bound process, especially for the WIM and DISM actions performed by this process). The following script will automate the process:
Start-Transcript C:\Scripts\UpdateDeploymentShare.log # Connect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$ # Update the deployment share Update-MDTDeploymentShare -Path DS002: -Verbose Stop-Transcript
Start-Transcript C:\Scripts\UpdateDeploymentShare.log
# Connect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$
# Update the deployment share Update-MDTDeploymentShare -Path DS002: -Verbose
Stop-Transcript
Save that as “UpdateDeploymentShare.ps1” and schedule it to run nightly using the Windows Task Scheduler. The action command line required (assuming you saved the script in C:\Scripts) would be:
PowerShell.exe -File C:\Scripts\UpdateDeploymentShare.ps1
Make sure you have configured PowerShell to allow script execution, e.g. “Set-ExecutionPolicy RemoteSigned”. And be sure to update the deployment share path above, as I’m sure your deployment share isn’t at \\MTN-SERVER\Distribution$.
If you haven’t figured out where we moved “media deployment points” in MDT 2010, they now have their own node: look under the “Advanced Configuration” node in Deployment Workbench and you’ll see the new “Media” node. You can create one or more media definitions there, specifying what content should be included in the media (by specifying the selection profile to use when copying content to the media), Windows PE settings to use, whether to generate an ISO, etc.
The “Update Media Content” action is what actually does the work, copying the specified content, generating boot images, and (optionally) generating ISOs. The following script automates this process, looping through each of the media items that you have defined:
Start-Transcript C:\Scripts\UpdateMedia.log # Connect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$ # Process each of the media items Get-ChildItem DS002:\Media | % { Update-MDTMedia -Path "DS002:\Media\$($_.Name)" -Verbose } Stop-Transcript
Start-Transcript C:\Scripts\UpdateMedia.log
# Connect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$
# Process each of the media items Get-ChildItem DS002:\Media | % { Update-MDTMedia -Path "DS002:\Media\$($_.Name)" -Verbose }
Save that as “UpdateMedia.ps1” and schedule it to run nightly using the Windows Task Scheduler. The action command line to run this (assuming again that the script is saved in C:\Scripts) would be:
PowerShell.exe -File C:\Scripts\UpdateMedia.ps1
Again, be sure to edit the path above, as \\MTN-SERVER\Distribution$ is the path to my deployment share, not yours.
Network deployment points, now called linked deployment shares, also have a new home in MDT 2010 Deployment Workbench: look for them under “Advanced Configuration”, in the “Linked Deployment Shares” folder. These too use selection profiles to specify what content should be replicated, so arrange your folder structures as needed and create a selection profile that includes the required folders.
The “Replicate Content” action performs the actual replication, copying the content specified in the configured selection profile. It can also optionally generate the boot images for the linked deployment share (although if you want to configure the Windows PE settings for that remote deployment share you’ll need to open that deployment share in the Deployment Workbench to make the changes). The following script initiates the same process:
Start-Transcript C:\Scripts\UpdateLinkedDS.log # Connect to the deployment share Add-PSSnapIn Microsoft.BDD.PSSnapIn -ErrorAction SilentlyContinue New-PSDrive DS002 MDTProvider \\MTN-SERVER\Distribution$ # Process each of the linked deployment share items Get-ChildItem "DS002:\Linked Deployment Shares" | % { Update-MDTLinkedDS -Path "DS002:\Linked Deployment Shares\$($_.Name)" -Verbose } Stop-Transcript
Start-Transcript C:\Scripts\UpdateLinkedDS.log
# Process each of the linked deployment share items Get-ChildItem "DS002:\Linked Deployment Shares" | % { Update-MDTLinkedDS -Path "DS002:\Linked Deployment Shares\$($_.Name)" -Verbose }
One last time: edit the path above to specify the path (either a local path or a UNC) to your deployment share. To run this using the Windows Task Schedule, specify an action command line like so:
PowerShell.exe -File C:\Scripts\UpdateLinkedDS.ps1
It’s been a long time coming, but we’re finally there: MDT 2010 was released today. See http://windowsteamblog.com/blogs/springboard/archive/2009/09/08/mdt-2010-is-released.aspx and http://blogs.technet.com/msdeployment/archive/2009/09/09/mdt-2010-is-released.aspx for the official announcements. The download is available now at http://www.microsoft.com/downloads/details.aspx?FamilyID=3bd8561f-77ac-4400-a0c1-fe871c461a89&displayLang=en.
I’ve been distracted while we worked on fixing the remaining bugs in MDT 2010, which was finally released today. Now it’s time to get back to the discussion on new features in MDT 2010. Next up on the list: improved driver management.
This is really a combination of two features we had already discussed:
with some capabilities added in that we haven’t already discussed. First, there are new options available in a Lite Touch task sequence’s “Inject drivers” step:
Now there are two options when injecting drivers:
You might choose the first option, you might choose the second – it just depends on how you want to do it. You might also choose to do both: you could create multiple “Inject driver” steps and specify different options and different selection profiles on both. For example, you might have one “always apply” selection profile with all the printer drivers that you support (whether currently attached or not) and an “only matching” selection profile for everything else. You could also set up multiple steps and place conditions on them, using different selection profiles and injection options based on the conditions (e.g. make and model).
Of course, if you want the process to be more dynamic, you can override the settings on the fly. I would foresee this being a very common scenario, where you either specify a different selection profile on the fly, or maybe instead specify a list of folders that should be used. To do this, you need to understand the available task sequence variables that can be configured through CustomSettings.ini:
It’s important to understand that these parameters have an “additive” effect. For example, if you specify a selection profile of “Everything” (all folders) and then specify “DriverGroup001=Toshiba\Tecra M400” the net result will be everything. But if you specified a selection profile of “Nothing” (no folders) and “DriverGroup001=Toshiba\Tecra M400” then the result would be just the one folder you specified. (DriverPaths values would be additive as well, but those aren’t recommended.)
So you have options. You can create multiple selection profiles and choose which one to use dynamically, something that gets messy if you just want one folder per selection profile (e.g. per model) since every new folder would require a new selection profile. Or you can choose the “Nothing” selection profile and then specify one or more folders via “DriverGroup”. I believe that will be the most common approach, as you can then do things like:
DriverSelectionProfile=Nothing DriverGroup001=%Make% DriverGroup002=%Make%\%Model% DriverGroup003=Peripherals
If you’ve already experimented with this and have some best practices to share, comments about challenges while implementing this, or just general questions, feel free to e-mail me at mniehaus@microsoft.com.
People have made fun of ConfigMgr, and every version of SMS before that, for being “slow moving software”. For those of you who try to deploy software to a machine and then wait for it to actually happen, you know what I mean: it was guaranteed to take two minutes from the time you advertised it to the time the first clients acted on it.
With ConfigMgr SP2, a significant portion of that delay (which was actually happening on the client side, not on the server) was removed. Now, I can add a new machine into a collection, then go to the machine and initiate a machine policy retrieval cycle and see a popup for new advertisements within a few seconds. The first time that happened I was a bit startled by the result – surely something must be wrong. But it wasn’t, the advertisement really was available that quickly.
ConfigMgr SP2 is still available as an RC through http://connect.microsoft.com, so you can try it out in your lab if you want. It is expected to be released by the end of October.
In MDT 2008, we provided unknown computer support for ConfigMgr 2007, since it didn’t provide that capability – you first had to import new computers into the ConfigMgr database before you could install an OS, so MDT helped automate that process. When ConfigMgr 2007 R2 was released, it included unknown computer functionality, so we have now removed most of that from MDT 2010.
One of the useful parts of this unknown computer process was a pre-execution hook that would run a wizard, leveraging the same wizard framework that we used for MDT 2010 Lite Touch deployments. This was useful because we provided all the pieces to make it work: the TSCONFIG.INI file that tells ConfigMgr what to run, the script that gets executed by ConfigMgr (referenced in TSCONFIG.INI), the rules processing logic to gather information from WMI and other data sources, and the wizard files themselves.
With MDT 2010, we’ve left these pieces in place, but set them up to do something more basic: prompt for a new computer name. This is provided as a sort of general purpose “sample”, showing how to hook this into ConfigMgr. While you might not find the sample particularly useful, you can edit the wizard definition (using Notepad or something like the MDT Wizard Editor, http://mdtwizardeditor.codeplex.com/) to add additional panes.
All the files related to this general purpose sample are located in the “C:\Program Files\Microsoft Deployment Toolkit\SCCM” directory:
So if you wanted too do some customization, the files you would want to change are the “Deploy_SCCM_Definition_ENU.xml” (to add or change wizard panes) and “Deploy_SCCM_Scripts.vbs” (to specify additional initialization or validation logic).
To actually get these pieces added into a boot image, you can check the “Add media hook files to enable the Deployment Wizard for this boot media” checkbox when running either the “Create Boot Image using Microsoft Deployment” wizard (which creates only new boot image which you would then need to configure the task sequence and ISOs to use) or the “Create Microsoft Deployment Task Sequence” wizard (which can create a new boot image as part of the task sequence creation process).
Booting from this boot image, you should see a wizard that looks like this:
You can then specify the computer name you want, which will set the OSDComputerName task sequence variable. Like I said, pretty simple, but provided as a starting point for your own customizations – just edit the XML and VBS files, create a new boot image, and then deploy. (Remember that all of these files are actually embedded in the boot image WIM file, so when you make changes you either need to create a new boot image or mount the existing one to change those files. Update the distribution points after making changes.)
I’ve also attached a short video that shows the startup process (including the initial ConfigMgr wizard screen that can be used for specifying static IP information and for typing in the media password).