Problem: I have one master deploymentshare that is contained on my mobile device, on a VM and when I deploy a server from that deploymentshare, I wish to create a deploymentshare on the new server and replicate in only content I chose

Solution:  OK, so I have Hyper-V installed on my laptop.  I have a Hyper-V virtual machine which I use as my deployment server.  This machine runs Server 2012R2.  On that server I have what I like to call my ‘Master’ deploymentshare.  This deploymentshare contains Operating Systems, Applications, Drivers and Packages that I have come across so far in the field and I add to it every day.   I use this to deploy servers on client sites and thereafter I use the extra network bandwidth, processing power and memory on the newly deployed server to deploy images to end user devices.

When I deploy a server, I have standard apps & scripts that run so they are built just the way I like them.  You can find out how to do this yourself by taking a look at my earlier post here:

Most recently I have been working a lot with Powershell and PSDrives and been looking into deploying fresh deploymentshares.  Now, it is advised to have two deploymentshares, one for a building and one for a production environment within your site. I haven’t really ‘rolled’ with this idea, I like to use one and manage it well, I’m not overly concerned about having to click a couple more times nor am I concerned about unauthorised people using it, that’s what passwords are for so I have opted for a ‘Master’ deploymentshare which contains all the drivers, patches, applications and operating systems that I have been requested to deploy in the field thus far.  It’s pretty huge now to be honest and I’m adding to it all the time.  I also have a standard list of items that I like to have on each deploymentshare I create.  So I started to think about how I could deploy a deploymentshare from a task sequence, making the deployed share a ‘Slave’ or ‘Child’ to the master, if you will, and how I would granularly deploy only what I wanted to (as not everything is needed at every site).

And so, working with selection profiles I created profiles for different scenarios which I might face in the field.  Supposing I change the variables in the script I wrote (see below),  I can deploy a new deploymentshare and replicate only what I chose with the selection profile.  I have adapted this script slightly differently in my own environments, reading variables in from a XML file I edit before each build, however I have generalised this script so that it will work for everyone.

All you would need to do is to add this into to your scripts folder and then call it by adding a powershell step into your task sequence.  I’ve tested it a few times and it works quite well.

I hope that this is exciting for you as it is for me, creating a selection profile for my client and then editing this scripts’ variables before deploying works for me!  Just bare in mind that your customsettings.ini and bootstrap.ini files wont be configured in your newly deployed share so these, along with the WinPE settings will need to be configured before you can use your new share.

Please let me know if you find this useful by commenting below.


Script to deploy a deploymentshare
Author:  Jonathan
Version: 1.0.0
    1. To deploy a new deploymentshare,
    2. Create a linked share on the deploy server (c:\deploymentshare$)
    3. Replicate content from deploy server to new share
    4. Replicate only the content selected in the selection profile
    1. Selection profile MUST already exist on deploy server
    2. Edit the four variables for your network
$SourceServer = "Server1"
$DestinationServer = "Server2"
$SourceDeploymentshare = "\\Server1\deploymentshare$"
$SelectionProfileName = "Basic Share"
Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1" -ErrorAction SilentlyContinue
Import-Module SmbShare
$DestinationDeploymentshare = "\\" + $DestinationServer + "\deploymentshare$"
$sharePath = "C:\DEPLOYMENTSHARE$"
New-Item $sharePath -ItemType directory -Verbose
New-SmbShare -Name DEPLOYMENTSHARE$ -Path $sharePath -FullAccess Everyone -Verbose
New-PSDrive -Name "DS001" -PSProvider MDTProvider 乏oot "C:\DEPLOYMENTSHARE$" -Description "Deploymentshare" -Verbose | add-MDTPersistentDrive -Verbose
New-PSDrive -Name "DESTDEPSHARE" -PSProvider MDTProvider -root $SourceDeploymentshare -Verbose
New-Item -path "DESTDEPSHARE:\Linked Deployment Shares" -enable "True" -Name $DestinationServer -Comments "" -Root $DestinationDeploymentshare -SelectionProfile "BASIC SHARE" -Replace "True" -CopyStandardFolders "True" -UpdateBoot "False" -Verbose
$Replicate ="DESTDEPSHARE:\Linked Deployment Shares\" + $SelectionProfileName
Update-MDTLinkedDS -Path $Replicate -Verbose


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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