Getting SmartCard Credentials

This topic contains 6 replies, has 4 voices, and was last updated by  Dan Potter 1 year ago.

  • Author
    Posts
  • #22653

    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

    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

    Peter Smith
    Participant

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

  • #51492

    Prakash Murugesan
    Participant

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

  • #51501

    Dan Potter
    Participant

    what he said.

    • This reply was modified 1 year ago by  Dan Potter.
  • #51505

    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

    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.