Private/Helper/Get-OSDisk.ps1

<#
Copyright © 2024 Integris. For internal company use only. All rights reserved.
#>


FUNCTION Get-OSDisk {
    <#
    .SYNOPSIS
    Retrieves the operating system disk.
 
    .DESCRIPTION
    This function identifies and returns the disk that contains the operating system by matching the system drive letter.
 
    .PARAMETER None
 
    .EXAMPLE
    Get-OSDisk
 
    .NOTES
    The function uses Get-Disk and Get-Partition cmdlets to determine the disk number of the system drive.
    #>


    RETURN (Get-Disk -Number (Get-Partition | Where-Object { $_.DriveLetter -eq $($ENV:SystemDrive).Replace(":","") }).DiskNumber)
}