Functions/Test-SwitchFunction.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
Function Test-SwitchFunction
{
<#
    .SYNOPSIS
        Test Synopsis
 
    .DESCRIPTION
        Test DESCRIPTION
 
    .PARAMETER Path
        Test Parameter
 
    .INPUTS
        Test INPUTS
 
    .OUTPUTS
        Test OUTPUTS
 
    .NOTES
        Test NOTES
 
    .EXAMPLE
        Test Example
 
    .LINK
        https://github.com/Panzerbjrn/ADtoolsModule
#>

    [CmdletBinding()]
    Param (
        [Parameter()][ValidateSet("Size","Name","DateCreated")][string]$SortOrder,
        [Parameter()][switch]$Descending
    )

    Switch ($SortOrder)
    {
        {($_ -eq "Size") -AND ($Descending)}{"Size $ Desscending";Break}
        {($_ -eq "Size") -AND (!($Descending))}{"Size $ not Desscending";Break}
        {($_ -eq "Name") -AND ($Descending)}{"Size $ Desscending";Break}
        {($_ -eq "Name") -AND (!($Descending))}{"Size $ not Desscending";Break}
        {($_ -eq "DateCreated") -AND ($Descending)}{"Size $ Desscending";Break}
        {($_ -eq "DateCreated") -AND (!($Descending))}{"Size $ not Desscending";Break}
    }
}