In this blog, I will illustrate a cheeky little improvisation in MDT that will enable you to install the operating system based upon the disk size of the client machine. Here was one of the interesting issue that i recently came across.
User has two disks in the servers, one was a smaller SSD disk while the larger one was meant to store the data and operating system, and interestingly there were no specific order in which disks were enumerate when booted up in winpe. i.e SSD disk will sometime be disk 0 and sometime will enumerate as disk 1, of two different servers, even though make and model were identical. so we cannot just manually change the disk number in "format and partition" step in disk to mitigate the problem of OS getting installed on the SSD disk. Off course putting a custom diskpart script was also out of equation since if a format and partition step is not called, it will end up failing the deployment.
So here is what we did to eventually get it working..
1. create a variable in TS and set this value as unassigned. In my lab i used my name Mayank to set the value as 'undefined'. (It should be called just before format and partition step in your TS.)
2. create a sample script, copy it in notepad and rename it "decisionscript.ps1". this script essentially identifies which disk is largest, the return value will be 0,1,2.. etc. Copy this script in scriptroot folder and call this script just after declaring the variable and before format and partition step.
foreach($i in $array)
If ($array[$m] -le $array[$j+1])
$tsenv:var = $mayank
3. Create "Format and partition" steps in MDT equals to the number of disks, (in our case there were two steps) and set an 'if' condition so that if value of the variable mayank is 0 "format and partition" step of MDT that will format disk 0 will be called and so on. At any point in time, only one step will be executed.
4. Now we need to add support for powershell in MDT and also need to ensure that $tsenv is available for us, for this, Mount litetouchpe
5. Copy the Microsoft.BDD.TasksequenceModule and ZTIUtility from tools\modules folder inside deployment share and copy it at c:\windows\system32\WindowsPowershell\v1.0\Modules folder inside the deployment share.
6. Commit the changes and unmount the wim. and use this to start the deployment.
thanks for reading!