mirror of
https://github.com/freedbygrace/Invoke-OperatingSystemDiskDetection.git
synced 2026-07-26 11:28:17 +00:00
44 lines
3.4 KiB
Markdown
44 lines
3.4 KiB
Markdown
# 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.
|
|
|
|
https://learn.microsoft.com/en-us/windows-hardware/drivers/storage/msft-Disk
|
|
|
|
Sample Output Generated By Script
|
|
|
|
VERBOSE: 10/16/2023 15:30:28.036 - A task sequence was not detected.
|
|
VERBOSE: 10/16/2023 15:30:28.111 - Detected 2 physical disk(s).
|
|
VERBOSE: 10/16/2023 15:30:28.115 - [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:30:28.117 - [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]
|
|
VERBOSE: 10/16/2023 15:30:28.119 - Attempting to process media type group "SSD" [Priority: 1]. Please Wait...
|
|
VERBOSE: 10/16/2023 15:30:28.12 - Attempting to process bus type group "NVMe" [Priority: 1]. Please Wait...
|
|
VERBOSE: 10/16/2023 15:30:28.123 - 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:30:28.124 - DiskNumber: 1
|
|
VERBOSE: 10/16/2023 15:30:28.125 - Manufacturer:
|
|
VERBOSE: 10/16/2023 15:30:28.125 - FriendlyName: Micron 2300 NVMe 1024GB
|
|
VERBOSE: 10/16/2023 15:30:28.126 - Model: Micron 2300 NVMe 1024GB
|
|
VERBOSE: 10/16/2023 15:30:28.126 - SerialNumber: 0000_0000_0000_0001_00A0_7521_2E85_6C41.
|
|
VERBOSE: 10/16/2023 15:30:28.127 - MediaType: SSD
|
|
VERBOSE: 10/16/2023 15:30:28.127 - MediaTypePriority: 1
|
|
VERBOSE: 10/16/2023 15:30:28.128 - BusType: NVMe
|
|
VERBOSE: 10/16/2023 15:30:28.129 - BusTypePriority: 1
|
|
VERBOSE: 10/16/2023 15:30:28.129 - SizeInGB: 953.87
|
|
|
|
|
|
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 : False
|