From 82cd8a76811584d8d505817cc9e911ed445e6158 Mon Sep 17 00:00:00 2001 From: freedbygrace Date: Tue, 17 Oct 2023 11:08:07 -0400 Subject: [PATCH] Update Invoke-OperatingSystemDiskDetection.ps1 Added the ability to filter out disks that are smaller the specified threshold. This will help in Intel Optane Cache situations as an example. --- Invoke-OperatingSystemDiskDetection.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Invoke-OperatingSystemDiskDetection.ps1 b/Invoke-OperatingSystemDiskDetection.ps1 index deb32a6..2a57495 100644 --- a/Invoke-OperatingSystemDiskDetection.ps1 +++ b/Invoke-OperatingSystemDiskDetection.ps1 @@ -25,7 +25,12 @@ [Parameter(Mandatory=$False)] [ValidateNotNullOrEmpty()] [Alias('BTEE')] - [Regex]$BusTypeExclusionExpression = '(^USB$)' + [Regex]$BusTypeExclusionExpression = '(^USB$)', + + [Parameter(Mandatory=$False)] + [ValidateNotNullOrEmpty()] + [Alias('DST')] + [UInt32]$DiskSizeThresholdInGB = 32 ) Try @@ -201,7 +206,7 @@ Try $DiskPropertyList.Add(@{Name = 'BusTypePriority'; Expression = ($DetermineBusTypePriority)}) $DiskPropertyList.Add(@{Name = 'SizeInGB'; Expression = {[System.Math]::Round(($_.Size / 1GB), 2)}}) - $OutputObjectProperties.DiskList = Get-PhysicalDisk | Where-Object {($_.BusType -inotmatch $BusTypeExclusionExpression)} | Sort-Object -Property @('Size') | Select-Object -Property ($DiskPropertyList) + $OutputObjectProperties.DiskList = Get-PhysicalDisk | Where-Object {($_.BusType -inotmatch $BusTypeExclusionExpression) -and ($_.Size -gt ($DiskSizeThresholdInGB / 1GB))} | Sort-Object -Property @('Size') | Select-Object -Property ($DiskPropertyList) $OutputObjectProperties.DiskListCount = ($OutputObjectProperties.DiskList | Measure-Object).Count $OutputObjectProperties.DesiredOperatingSystemDisk = $Null $OutputObjectProperties.DesiredOperatingSystemDiskLocated = $False