I have a valid set of credentials stored in $Cred.
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $Password
Clearly they work like this:
PS C:\> $login=Test-ADAuthentication -username $Cred.UserName -password $Cred.GetNetworkCredential().Password
PS C:\> echo $login
True
However, I would like to pass them using only the $Cred variable if possible.
I have tried both of these, but neither work.
PS C:\> $login=Test-ADAuthentication -credential $Cred
PS C:\> echo $login
False
PS C:\> $login=Test-ADAuthentication -PSCredential $Cred
PS C:\> echo $login
False
Any help on this one?
Note: the only tag I found that was close to my question, was azure-ad-authentication-protocols... which isn't actually about my question, but I couldn;t submit the question without a tag.. so..