Finding the max size of a tiered storage space - Windows Server 2022

As part of the work I have done in my homelab with tiered storage on Server 2022 storage spaces, here is a script I created that allows you to easily find the max size of a tiered storage space

Drop this in a .ps1 file and watch it go:

#start
write-output "
=================================================================
Welcome to the EASYTIERSIZEMAX script.

By Luke Varley  - www.phishandchips.dev

This script will allow you to easily Calculate the max size of a Tiered Storage Spaces
Virtual Disk when you add new a SSD or HDD.

Read the comments in the script for instructions

#Created with knowledge obtained from
 Philippe Tschumi
#Credit: https://techblog.ptschumi.ch/automation-scripting/storage-spaces-direct-query-maximum-tier-size-storage-tiers/
=================================================================
"

$vdisks = Get-VirtualDisk
$diskdata=@()
 
foreach ($vdisk in $vdisks){
    $storagetiers = Get-StorageTier -VirtualDisk $vdisk
    $i=0
 
    foreach ($storagetier in $storagetiers){
        # ResiliencySettingName can be Mirror, Simple or Parity depending on your deployment
        $tier = $storagetier | Get-StorageTierSupportedSize -ResiliencySettingName Simple # edit ResiliencySettingName
        $tiermin = ($tier.TierSizeMin/1GB)
        $tiermax = ($tier.TierSizeMax)/1GB
        $tierdivisor = ($tier.TierSizeDivisor)/1GB
        $object = New-Object -TypeName PSObject -Property (@{
            'vDisk'= $vdisk.FriendlyName;
            'StorageTier'= $storagetier.FriendlyName
            'TierSizeMin'= $tiermin;
            'TierSizeMax'= $tiermax;
            'TierSizeDivisor'= $tierdivisor
        })
        $diskdata += $object
        $i++
    }
}
$diskdata | Select-Object vDisk, StorageTier, TierSizeMin, TierSizeDivisor, TierSizeMax | ft -AutoSize

No comments:

Post a Comment

Removing tiered storage spaces - Windows Server 2022

As part of the work I have done in my homelab with tiered storage on Server 2022 storage spaces , here is a script I created that allows you...