Problem: I have one master deploymentshare that is contained on my mobile device, perhaps 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: http://deploymentshare.com/post/singular-task-sequence-multiple-jobs
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.
2: Script to deploy a deploymentshare
4: Author: Jonathan of www.deploymentshare.com
5: Version: 1.0.0
8: 1. To deploy a new deploymentshare,
9: 2. Create a linked share on the deploy server (c:\deploymentshare$)
10: 3. Replicate content from deploy server to new share
11: 4. Replicate only the content selected in the selection profile
14: 1. Selection profile MUST already exist on deploy server
15: 2. Edit the four variables for your network
18: # EDIT THESE FOR YOUR NETWORK
19: $SourceServer = "Server1"
20: $DestinationServer = "Server2"
21: $SourceDeploymentshare = "\\Server1\deploymentshare$"
22: $SelectionProfileName = "Basic Share"
25: # IMPORT MODULES AND SET DESTINATION
26: Import-Module "C:\Program Files\Microsoft Deployment Toolkit\bin\MicrosoftDeploymentToolkit.psd1" -ErrorAction SilentlyContinue
27: Import-Module SmbShare
28: $DestinationDeploymentshare = "\\" + $DestinationServer + "\deploymentshare$"
30: # CREATE NEW SHARE ON TARGET SERVER
31: $sharePath = "C:\DEPLOYMENTSHARE$"
32: New-Item $sharePath -ItemType directory -Verbose
33: New-SmbShare -Name DEPLOYMENTSHARE$ -Path $sharePath -FullAccess Everyone -Verbose
35: # CREATE NEW DEPLOYMENTSHARE (ON ROOT OF C:\)
36: New-PSDrive -Name "DS001" -PSProvider MDTProvider –Root "C:\DEPLOYMENTSHARE$" -Description "Deploymentshare" -Verbose | add-MDTPersistentDrive -Verbose
38: # ADD LINKED SHARE TO DEPLOY SERVER
39: New-PSDrive -Name "DESTDEPSHARE" -PSProvider MDTProvider -root $SourceDeploymentshare -Verbose
40: New-Item -path "DESTDEPSHARE:\Linked Deployment Shares" -enable "True" -Name $DestinationServer -Comments "" -Root $DestinationDeploymentshare -SelectionProfile "BASIC SHARE" -Replace "True" -CopyStandardFolders "True" -UpdateBoot "False" -Verbose
42: # REPLICATE
43: $Replicate ="DESTDEPSHARE:\Linked Deployment Shares\" + $SelectionProfileName
44: Update-MDTLinkedDS -Path $Replicate -Verbose