cancel
Showing results for 
Search instead for 
Did you mean: 
Lenovo Employee pjorgensen
Views: 4,518
Symptoms

 

Windows installs to the SATA disk instead of the NVMe drive during an Operating System Deployment with SCCM.

 
Diagnosis

 

Systems with a dual drive (or more) configuration, an NVMe drive and either a SATA mechanical disk or SATA SSD will be installed.  In some cases, the SATA disk may be enumerated as Disk 0 and the NVMe drive as Disk 1.  This can be confirmed by booting to WinPE, executing the DiskPart utility and selecting disk 0 and/or disk 1, followed by the command detail disk.  Note the type of disk displayed, which will either be SATA or NVMe.

 

In a default standard SCCM OSD task sequence, disk 0 will be formatted and partitioned depending on the partition scheme assigned (MBR or GPT).

 

(Note: As newer hardware is released, the SATA mechanical disks or even SATA SSD disks will be replaced with NVMe disks.)

 

Solution

 

Ideally, Windows should be installed to the NVMe drive instead of a mechanical SATA disk or SATA SSD. 

 

Consider the following drive configuration:

 

1x1GB NVMe + 1x512GB NVMe + 1x16GB Optane NVMe (Memory Cache)

 

There is a possibility that the larger NVMe drive will be detected as disk 0, which Windows will be installed to.  Ideally, Windows should be installed to the 512GB NVMe.

 

As a workaround, the below PowerShell script will identify all physical drives installed and assign the smallest NVMe disk as disk 0 by dynamically setting the OSDDiskIndex action variable.  This will prevent Windows installing on any smaller drives designated as memory cache drives.

 

(Note: Any NVMe drives smaller than 120GB are excluded as well)

 

# Count Disks
Write-Output "Checking the Drive Count..."
$diskCount = (Get-Disk).Number.Count

if ($diskCount -eq 1)
    {
    Write-Output "Only 1 installed. Move along..."   
    }

# If there's more than 1, check for NVMe's.
# Only NVMe disks larger than 120GB will be targeted.  This should exclude smaller Optane drives.
elseif ($diskCount -gt 1)
    {
    Write-Output "There's more than 1 disk installed. Check if any NVMe's are installed."
    
    $nvmeDsks = (Get-WmiObject -Namespace root\microsoft\windows\storage -Class msft_disk) |
        ?{$_.BusType -eq 17} | Where-Object {$_.Size -gt 128849018880}
    
    $i = $nvmeDsks.Count

    Write-Output "Found $i NVMe disk(s)"
    
# Identify the smallest disk to install the OS to
    Write-Output "Determining the smaller disk to assign as disk 0"
    $osDisk = ($nvmeDsks | Sort-Object -Property Size | Select-Object -First 1).Number
    
    Write-Output "Ready to deploy"
    }

if (!($nvmeDsks))
    {
    Write-Output "No NVMe disk found..."
    }          

# Initialize SMS TS environment.
$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
        
# If there's NVMe's installed, set TS variable 'OSDDiskIndex' to the smallest one.

if ($nvmeDsks)
    {
    $TSEnv.Value("OSDDiskIndex") = $osDisk
    Write-Output "NVMe should now equal Disk 0 in the TS."
    }

 

Save the above code as a .ps1 file and copy to a source location.  Create a standard Package in your console, specify source folder containing the .ps1 file.  Distribute package to distribution points.

 

Create or edit an existing task sequence:

 

 

  • Add a new Format and Partition Disk step above the original Partition Disk 0 step.
    • Leave the Disk Number as 0 (This will eventually end up as the SATA disk)
    • Create a new volume.  Partition name is optional.
    • Partition type set to Primary using 100% of free space
    • Format as NTFS (Quick)

 

 

  • Add a Run PowerShell Script step
    • Browse to Package containing script
    • Enter script name
    • Set execution policy to Bypass

 Example

Capture1.PNG

 

An improvement in version 1902 of Configuration Manager Current Branch, you can now directly enter PowerShell code in the Run PowerShell Script step.  If you choose this route, simply enter the above code and select Bypass for the execution policy.

 

Capture.PNG

 

Once the system has completed the OSD, you can run the following PowerShell command to confirm Disk 0 now equals the NVMe drive

 

Get-Disk | %{$_.number,$_.friendlyname}

or open Disk Management.

Was this information helpful?

Contributors