forked from lzybkr/TabExpansionPlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetSecurity.ps1
More file actions
42 lines (33 loc) · 1.5 KB
/
Copy pathNetSecurity.ps1
File metadata and controls
42 lines (33 loc) · 1.5 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
## NetSecurity module Custom Completers ##
#
# .SYNOPSIS
#
# Complete the -Name argument to *-NetConnectionProfile cmdlets
#
function NetFirewallRuleNameParameterCompleter
{
[ArgumentCompleter(
Parameter = 'Name',
Command = { Get-CommandWithParameter -Module NetSecurity -Noun NetFirewallRule -ParameterName Name | Where-Object Verb -ne New},
Description = 'Complete the -Name argument to *-NetFirewallRule cmdlets, for example: Get-NetFirewallRule -Name <TAB>')]
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
NetSecurity\Get-NetFirewallRule -Name "$wordToComplete*" | Sort-Object Name | ForEach-Object {
New-CompletionResult $_.Name "Name: $($_.Name)"
}
}
#
# .SYNOPSIS
#
# Complete the -DisplayName argument to *-NetFirewallRule cmdlets
#
function NetFirewallRuleDisplayNameParameterCompleter
{
[ArgumentCompleter(
Parameter = 'DisplayName',
Command = { Get-CommandWithParameter -Module NetSecurity -Noun NetFirewallRule -ParameterName DisplayName | Where-Object Verb -ne New},
Description = 'Complete the -DisplayName argument to *-NetFirewallRule cmdlets, for example: Get-NetFirewallRule -DisplayName <TAB>')]
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
NetSecurity\Get-NetFirewallRule -DisplayName "$wordToComplete*" | Sort-Object DisplayName | ForEach-Object {
New-CompletionResult $_.DisplayName "DisplayName: $($_.DisplayName)"
}
}