Stephensr Posted October 26, 2011 Report post Posted October 26, 2011 Morning all, I’ve been looking at an issue for the last couple of days that has me somewhat confused. I know there have been other posts regarding this but I’ve not yet seen a definitive reason behind it… We have a small number of systems in the environment that have two physical drives for example a 75GB and a 300GB drive, meaning the preferred setup would be: Disk 0 (75GB) 200 MB: System reserved 50GB: OSDisk 24GB: Data Partition Disk 1 (300GB) 300GB: Extra Can someone please explain why in Win PE these disk randomly swap between Disk 0 and Disk 1?? I need to ensure that in a system refresh scenario these desktops only ever have W7 Enterprise installed to Disk 0 (in the example above) thus leaving Disk 1 alone. We are using the OSPart task sequence variable at the apply OS Phase so I am going to try to use the following script that I believe Niall had a hand in creating in order to target the current partition that has Windows installed: <job id="GetDriveletter"> <script language="VBScript" src="..\ZTIUtility.vbs"/> <script language="VBScript"> dim driveSearch Set objFSO = CreateObject("Scripting.FileSystemObject") Set colDrives = objFSO.Drives For Each objDrive in colDrives driveSearch = objDrive.DriveLetter & ":\\Windows\\explorer.exe" strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colFiles = _ objWMIService.ExecQuery("Select * From CIM_DataFile Where Name = '" & driveSearch & "'") If colFiles.Count < 1 Then Else oEnvironment.Item("OSPART") = objDrive.DriveLetter & ":" End If Next </script> </job> I would still very much like some insight as to why the Disk numbers change at what seems to be random intervals….is it a hardware issue i.e. symptom of using SATA drives, or that OSD prefers the larger drive.... Thanks. Rich. Quote Share this post Link to post Share on other sites More sharing options...
Lucid Posted October 27, 2011 Report post Posted October 27, 2011 Does this answer your question? http://support.microsoft.com/kb/937251 Quote Share this post Link to post Share on other sites More sharing options...
walsallf Posted August 18, 2017 Report post Posted August 18, 2017 Hi, In relation to the above, we have just had some new kit in which has 2 drives, 1 x SSD and 1x spinny disk. I've managed to get the Task Sequence working to deploy Win 10 1703 to the PC and install Windows on the SSD and format the spinny disk and rename it to V: I have an original task Sequence which works on single disk machines, but I now need to combine the two, where I have just 1 task sequence which can figure out how many disks are in the machine and then format the machine and install Windows accordingly. The guy preceding me had written a VB script to count the number of disks before formatting, but this fails with "GetObject - Permission Denied". I amended the script to use sWBEMLocator, which I found in another post, but again this comes back with permission denied. Is there anybody else that has done anything similar to this? I have upgraded everything to the latest, so we are on SCCM Current Branch 1703 and MDT 8443. Thanks Quote Share this post Link to post Share on other sites More sharing options...
walsallf Posted August 29, 2017 Report post Posted August 29, 2017 In case it helps anybody, I managed to get it working by adding the Powershell components to the Boot Image and then writing a Powershell script to count the number of disks instead of a VB script. Works like a charm. Quote Share this post Link to post Share on other sites More sharing options...
GarthMJ Posted August 29, 2017 Report post Posted August 29, 2017 why don't you post the solution for other to find? Either here or on your own blog with a link here. Quote Share this post Link to post Share on other sites More sharing options...
walsallf Posted August 30, 2017 Report post Posted August 30, 2017 On the properties of the Boot Image, under Optional Components, add the Powershell Components. Note: NetFx is a prerequisite. Then in my Task Sequence, I have to format disk 0, so that it will receive the script package, in case there are no existing partitions. Then it deploys the CountDisks script: $TSenv = New-Object -COMObject Microsoft.SMS.TSEnvironment #get the physical disks in the local system $disks=Get-disk $physicaldisks=Get-PhysicalDisk #enumerate the number of disks $NumberOfDisks=($physicaldisks | measure).count $TSenv.Value("osdDrives") = $NumberOfDisks $TSEnv.Value('OSDDiskIndex') = Get-PhysicalDisk | Select FriendlyName,MediaType,DeviceID | Where MediaType -eq 'SSD' | Select -ExpandProperty DeviceID Then use osdDrives and OSDDiskIndex as Task Sequence variables to filter the steps. So if it's a single disk machine, osdDrives = 1, so format Disk 0 and continue as normal. If osdDrives = 2, and OSDDiskIndex = 0, then it has 2 disks and the SSD is Disk 0. In that case, clean the partitions off Disk 1 and format Disk 0. If osdDrives = 2, and OSDDiskIndex = 1, then it's vice versa. Then later on in the Task Sequence, after the Setup Windows and ConfigMgr step, run the script to format the second disk and rename the drive letter. There may be a better way to do this, but I finally got it working this way. Quote Share this post Link to post Share on other sites More sharing options...
BenjaminB Posted February 20, 2019 Report post Posted February 20, 2019 Hello i am a noob with SCCM task sequence. Could you post some screen capture of your configuration. Thanks. Quote Share this post Link to post Share on other sites More sharing options...