Public/Get-CredentialBaseName.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<#
 .Synopsis
  Returns the base part of a username in a credential object. See Get-UserBaseName

 .Description
  Returns the username of a credential object. If the credential object is a distringuished name the first part of the user object is used
  
 .Parameter UserCredential
  The credential object
#>

Function Get-CredentialBaseName {
    [CmdletBinding(SupportsShouldProcess=$False)]
    param ([parameter(Mandatory)][PSCredential] $UserCredential)
    
    [string] $credBaseName = Get-UserBaseName ($UserCredential.UserName)
    Return $credBaseName
}