Private/Test-CompressionUnsupported.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<#
    .SYNOPSIS
    Test if Pool is compatible with compression
    .DESCRIPTION
    Test if Pool is compatible with compression.
    Test if OS version is -ge 4.1
    Test if compression licence is available
    Test if compression feature is enabled
    Test if Pool is Extreme_Performance only
#>



Function Test-CompressionUnsupported {
  [CmdletBinding()]
  Param(
    [parameter(Mandatory = $true)]
    $Session,
    [parameter(Mandatory = $true)]
    $Pool
  )

  Process {

    [bool]$Result = $True

    If ($Session.SoftwareVersion -lt [version]'4.1') {
      #Write-Verbose "Software version lesser than 4.1.0"
      $Result = $false
    }
    If ($Session.isUnityVSA()) {
      #Write-Verbose "Array is an UnityVSA"
      $Result = $false
    }
    If (-not (Get-UnityPool -Session $Session -Id $Pool -ErrorAction SilentlyContinue).isExtremePerformance()) {
      #Write-Verbose "Pool is not Extreme Performance only"
      $Result = $false
    }
    If ((Get-UnityFeature -Session $Session -id INLINE_COMPRESSION -ErrorAction SilentlyContinue).State -ne 'FeatureStateEnabled') {
      #Write-Verbose "Feature INLINE_COMPRESSION is disabled"
      $Result = $false
    }
    If ((Get-UnityLicense -Session $Session -id INLINE_COMPRESSION -ErrorAction SilentlyContinue).isValid -ne $True) {
      #Write-Verbose "Licence INLINE_COMPRESSION is not valid"
      $Result = $false
    }

    Write-Verbose "Is compression supported: $Result"
    Return $Result
  }
}