i need store credential in powershell used several times. here on stackoverflow there lot of example, took one
$tmpcred = get-credential $tmpcred.password | convertfrom-securestring | set-content "pwd.dat" $password = get-content "pwd.dat" | convertto-securestring $credential = new-object system.management.automation.pscredential "mydomain\myuser", $password get-aduser -credential $credential unfortunately error , can't find solution
get-aduser : server has rejected client credentials. @ line:5 char:11 + get-aduser <<<< "xxx" -credential $credential + categoryinfo : notspecified: (xxx:aduser) [get-aduser], authenticationexception + fullyqualifiederrorid : server has rejected client credentials.,microsoft.activedirectory.management.commands.getaduser
i can't see wrong code, i'm guessing example of how using mention need use in several places. check storing of secure string failing check using following, should prove credentials worked before being persisted disk:
get-aduser -credential $tmpcred one option pass around credentials rather file or securestring, using type [system.management.automation.pscredential] returned call get-credentials , stored in variable $tmpcred.
you temporarily add call method getnetworkcredentials() ensure password has been decrypted correctly, following show username , password (unencrypted):
$tmpcred.getnetworkcredential().username $tmpcred.getnetworkcredential().password hope helps...
Powershell Credential Rejected From Server - >>>>> Download Now
ReplyDelete>>>>> Download Full
Powershell Credential Rejected From Server - >>>>> Download LINK
>>>>> Download Now
Powershell Credential Rejected From Server - >>>>> Download Full
>>>>> Download LINK 6F