Getting SmartCard Credentials

This topic contains 6 replies, has 4 voices, and was last updated by Profile photo of Dan Potter Dan Potter 3 months, 2 weeks ago.

  • Author
    Posts
  • #22653
    Profile photo of Peter Smith
    Peter Smith
    Participant

    Is there a way of using Powershell to get smartcard credentials?

    Use Case.
    I need to remote to a bunch of servers and disable specific task. The servers need my smartcard credentials.

    thanks

  • #22665
    Profile photo of Jack Neff
    Jack Neff
    Participant

    Creds are creds, there's no difference except when the UAC prompts you type a pin instead of user/pw. By default, any command you run inside a PoSH will use the credentials you used to launch the shell. Some cmdlets like "Invoke-Command" have a -Credential parameter that allow you to provide different credentials.

  • #22677
    Profile photo of Peter Smith
    Peter Smith
    Participant

    So now I say DOH!! Thanks for the quick response... Don't know why I did not just do it!

  • #51492
    Profile photo of Prakash Murugesan
    Prakash Murugesan
    Participant

    How i can pass smart-card credential to invoke-command ?

  • #51501
    Profile photo of Dan Potter
    Dan Potter
    Participant

    what he said.

    • This reply was modified 3 months, 2 weeks ago by Profile photo of Dan Potter Dan Potter.
  • #51505
    Profile photo of Prakash Murugesan
    Prakash Murugesan
    Participant

    Invoke-Command -ComputerName servername.fqdn -ScriptBlock{get-process} -Credential domain\username

    in this if i pass my credential password it works if i pass smart card pin its not working.

  • #51510
    Profile photo of Dan Potter
    Dan Potter
    Participant

    works for me.

    $cred = get-credential #select smartcard enter pin
    Invoke-Command -ScriptBlock{get-process} -ComputerName myserver -Credential $cred

You must be logged in to reply to this topic.