Skip to content

Commit

Permalink
fix test-cred logic path
Browse files Browse the repository at this point in the history
  • Loading branch information
RamblingCookieMonster committed Oct 6, 2015
1 parent 96dc090 commit 2d2f555
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Test-Credential.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@
}

#create principal context with appropriate context from param. If either comp or domain is null, thread's user's domain or local machine are used
if ($PSCmdlet.ParameterSetName -eq 'Domain')
if ($Context -eq 'ApplicationDirectory' )
{
#Name=$null works for machine/domain, not applicationdirectory
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::$Context)
}
elseif ($PSCmdlet.ParameterSetName -eq 'Domain')
{
$Context = $PSCmdlet.ParameterSetName
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::$Context, $Domain)
Expand All @@ -85,11 +90,7 @@
$Context = $PSCmdlet.ParameterSetName
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::$Context, $ComputerName)
}
elseif ($Context -eq 'ApplicationDirectory' )
{
#Name=$null works for machine/domain, not applicationdirectory
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::$Context)
}

}
Process
{
Expand Down

0 comments on commit 2d2f555

Please sign in to comment.