Jump to content


Stephensr

The Multiple Hard Drive Question.....

Recommended Posts

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.

Share this post


Link to post
Share on other sites


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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

why don't you post the solution for other to find?  Either here or on your own blog with a link here.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...