DnsClient.ArgumentCompleters.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## DnsClient module Custom Completers ##

#
# .SYNOPSIS
#
# Complete the -InterfaceAlias arguments to DnsClient module cmdlets
#
function DnsClientInterfaceAliasParameterCompleter
{
    param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

    DnsClient\Get-DnsClient -InterfaceAlias "$wordToComplete*" | Sort-Object InterfaceAlias | ForEach-Object {
        New-CompletionResult $_.InterfaceAlias "InterfaceAlias: $($_.InterfaceAlias)"
    }
}


Register-ArgumentCompleter `
    -Command ('Get-DnsClient','Get-DnsClientServerAddress','Set-DnsClient','Set-DnsClientServerAddress') `
    -Parameter 'InterfaceAlias' `
    -Description 'Complete the -InterfaceAlias arguments to DnsClient module cmdlets. For example: Get-DnsClient -InterfaceAlias <TAB>' `
    -ScriptBlock $function:DnsClientInterfaceAliasParameterCompleter