internal/functions/Test-IsDistinguishedName.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
function Test-IsDistinguishedName
{
<#
    .SYNOPSIS
        Lightweight test to check whether a string is a distinguished name.
     
    .DESCRIPTION
        Lightweight test to check whether a string is a distinguished name.
        This check is done by checking, whether the string contains a "DC=" sequence.
     
    .PARAMETER Name
        The name to check.
     
    .EXAMPLE
        PS C:\> Test-IsDistinguishedName -Name $name
     
        returns whether $name is a distinguished name.
#>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]
        $Name
    )
    
    process
    {
        $Name -match 'DC='
    }
}