forked from anwather/My-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyAdvancedFunction.ps1
More file actions
52 lines (38 loc) · 1.38 KB
/
MyAdvancedFunction.ps1
File metadata and controls
52 lines (38 loc) · 1.38 KB
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
function MyAdvancedFunction
{
Param(
#Mandatory Parameter
[Parameter(Mandatory=$true)]
[string] $Name,
#Default Value
[Parameter()]
[int] $Age = 18,
#Parameter Sets
[Parameter(ParameterSetName = "Set 1")]
[string] $Set1Value,
[Parameter(ParameterSetName = "Set 2")]
[string] $Set2Value,
[Parameter(Mandatory = $true, HelpMessage = "This is the help for this message")]
[string] $HelpValue,
#Parameter Alias
[Parameter()]
[alias("ComputerName","MachineName")]
[string] $ServerName,
#Parameter Length Validation
[Parameter()]
[ValidateLength(4,4)]
[string] $PostCode,
#Parameter Range Validation
[Parameter()]
[ValidateRange(2000,8999)]
[int] $PostCodeV2,
#Parameter Script Validation
[Parameter()]
[ValidateScript({Test-Connection -ComputerName $_ -Count 1 -Quiet})]
[string] $TestServer,
#Validate Set
[Parameter()]
[ValidateSet("High","Medium","Low")]
[string] $Severity
)
}