Hi.
I have created a couple of identities within Powershell Universal but the logins are not working.
My authentication.ps1 looks like this:
Set-PSUAuthenticationMethod -Type "Form" -ScriptBlock {
param(
[PSCredential]$Credential
)
#
# You can call whatever cmdlets you like to conduct authentication here.
# Just make sure to return the $Result with the Success property set to $true
#
if ($Credential.UserName -eq 'Admin' -and $Credential.GetNetworkCredential().Password -eq '123')
{
New-PSUAuthenticationResult -Success -UserName 'Admin'
}
else
{
New-PSUAuthenticationResult -ErrorMessage 'Bad username or password'
}
# elev
if ($Credential.UserName -eq 'elev' -and $Credential.GetNetworkCredential().Password -eq '123')
{
New-PSUAuthenticationResult -Success -UserName 'elev'
}
else
{
New-PSUAuthenticationResult -ErrorMessage 'Bad username or password'
}
}
The admin login works but not the user ‘elev’. What am im doing wrong here?