-
Notifications
You must be signed in to change notification settings - Fork 0
/
param_block.ps1
57 lines (45 loc) · 1.54 KB
/
param_block.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
51
52
53
54
55
56
57
function Test-ParamBlocks {
[CmdletBinding(DefaultParameterSetName = 'None')]
Param (
[Parameter(Mandatory = $true)]
[ValidateSet('Tom','Dick','Jane')]
[string]$Name,
[ValidateRange(60,999)]
[Int32]$Age = 60,
[ValidateLength(1,256)]
[String]$StreetName,
[ValidatePattern("[0-9][0-9][0-9][0-9][0-9]")]
[String]$ZipCode,
[ValidateScript({ !(Test-Path -Path $_) })]
[string]$Path,
[string]$OutputPath = (Join-Path -Path $PWD -ChildPath 'Output'),
[Parameter(ParameterSetName = 'OS')]
[ValidateSet(
'Microsoft Windows 10 Enterprise',
'Microsoft Windows Server 2016 Member Server',
'Microsoft Windows Server 2016 Domain Controller',
'Microsoft Windows Server 2019 Member Server',
'Microsoft Windows Server 2019 Domain Controller'
)]
[string]$OS,
[Parameter(ParameterSetName = 'OS')]
[string]$OSBuild,
[Parameter(ParameterSetName = 'Browser')]
[ValidateSet(
'Microsoft Edge',
'Google Chrome',
'Mozilla FireFox'
)]
[string]$Browser
)
Process {
$Age
$OutputPath
}
}
Test-ParamBlocks
Test-ParamBlocks -Name 'Mike'
Test-ParamBlocks -Name 'Tom' -Age 51
Test-ParamBlocks -Name 'Tom' -OS 'Microsoft Windows Server 2019 Domain Controller' -Browser 'Microsoft Edge'
Show-Command Test-ParamBlocks
Test-ParamBlocks -Browser 'Microsoft Edge' -OS 'Microsoft Windows 10 Enterprise'