Files
2023-10-17 08:22:30 -04:00

4.5 KiB

Invoke-OperatingSystemDiskDetection

Dynamically determines the desired operating system disk based on a calculated MediaType and BusType priority.

This solves for issues in devices that have multiple hard disk(s) where operating system gets installed onto the incorrect disk.

This method bypasses any manual determination required across all models and devices.

By default, the operating system will get deployed onto the fatest and smallest disk.

If a task sequence is running, the required task sequence variables (More can be added) will be configured so that the Format and Partition steps will format the correct hard disk.

The hard disk media type and bus type definitions can be found here: https://learn.microsoft.com/en-us/windows-hardware/drivers/storage/msft-Disk

Sample Output Generated By Script

VERBOSE: 10/16/2023 15:49:18.023 - A task sequence was detected.

VERBOSE: 10/16/2023 15:49:18.26 - Detected 2 physical disk(s).

VERBOSE: 10/16/2023 15:49:18.262 - [DiskNumber: 1] [Manufacturer: ] [FriendlyName: Micron 2300 NVMe 1024GB] [Model: Micron 2300 NVMe 1024GB] [SerialNumber: 0000_0000_0000_0001_00A0_7521_2E85 _6C41.] [MediaType: SSD] [MediaTypePriority: 1] [BusType: NVMe] [BusTypePriority: 1] [SizeInGB: 953.87]

VERBOSE: 10/16/2023 15:49:18.264 - [DiskNumber: 0] [Manufacturer: ] [FriendlyName: PC601 SED NVMe SK hynix 1TB] [Model: PC601 SED NVMe SK hynix 1TB] [SerialNumber: ACE4_2E00_157D_071D_2EE4_A C00_0000_0001.] [MediaType: SSD] [MediaTypePriority: 1] [BusType: NVMe] [BusTypePriority: 1] [SizeInGB: 953.87]

VERBOSE: 10/16/2023 15:49:18.266 - Attempting to process media type group "SSD" [Priority: 1]. Please Wait...

VERBOSE: 10/16/2023 15:49:18.267 - Attempting to process bus type group "NVMe" [Priority: 1]. Please Wait...

VERBOSE: 10/16/2023 15:49:18.269 - The desired operating system disk was found in media type group "SSD" [Priority: 1] and bus type group "NVMe" [Priority: 1].

VERBOSE: 10/16/2023 15:49:18.27 - DiskNumber: 1

VERBOSE: 10/16/2023 15:49:18.271 - Manufacturer:

VERBOSE: 10/16/2023 15:49:18.272 - FriendlyName: Micron 2300 NVMe 1024GB

VERBOSE: 10/16/2023 15:49:18.273 - Model: Micron 2300 NVMe 1024GB

VERBOSE: 10/16/2023 15:49:18.274 - SerialNumber: 0000_0000_0000_0001_00A0_7521_2E85_6C41.

VERBOSE: 10/16/2023 15:49:18.274 - MediaType: SSD

VERBOSE: 10/16/2023 15:49:18.275 - MediaTypePriority: 1

VERBOSE: 10/16/2023 15:49:18.275 - BusType: NVMe

VERBOSE: 10/16/2023 15:49:18.276 - BusTypePriority: 1

VERBOSE: 10/16/2023 15:49:18.277 - SizeInGB: 953.87

VERBOSE: 10/16/2023 15:49:18.28 - Attempting to set the value of task sequence variable "OSDDiskIndex" to "1". Please Wait...

VERBOSE: 10/16/2023 15:49:18.282 - Attempting to set the value of task sequence variable "OSDiskNumber" to "1". Please Wait...

VERBOSE: 10/16/2023 15:49:18.282 - Attempting to set the value of task sequence variable "OSDDiskCount" to "2". Please Wait...

DiskList : {@{DiskNumber=1; Manufacturer=; FriendlyName=Micron 2300 NVMe 1024GB; Model=Micron 2300 NVMe 1024GB; SerialNumber=0000_0000_0000_0001_00A0_7521_2E85_6C41.; MediaType=SSD; MediaTypePriority=1; BusType=NVMe; BusTypePriority=1; SizeInGB=953.87},
@{DiskNumber=0; Manufacturer=; FriendlyName=PC601 SED NVMe SK hynix 1TB; Model=PC601 SED NVMe SK hynix 1TB; SerialNumber=ACE4_2E00_157D_071D_2EE4_AC00_0000_0001.; MediaType=SSD; MediaTypePriority=1; BusType=NVMe; BusTypePriority=1; SizeInGB=953.87}}

DiskListCount : 2

DesiredOperatingSystemDisk : @{DiskNumber=1; Manufacturer=; FriendlyName=Micron 2300 NVMe 1024GB; Model=Micron 2300 NVMe 1024GB; SerialNumber=0000_0000_0000_0001_00A0_7521_2E85_6C41.; MediaType=SSD; MediaTypePriority=1; BusType=NVMe; BusTypePriority=1; SizeInGB=953.87}

DesiredOperatingSystemDiskLocated : True

IsTaskSequenceRunning : True

Alt text Alt text Alt text Alt text