Sorry if this is in the wrong community but it seemed the best.
My organization is trying to automate the commands that it has done manually before (Indexing computer storage, etc.). However, we use smart cards instead of standard username/password.
I am trying to pass Get-Credential
to Get-ADComputer
So we can use our smart cards without directly remoting in (that way we can just run the script and forget about it). Unfortunately, it is not working.
Our smart cards have two logins (one admin, one regular). Could that be the issue? Get-Credential
opens up twice asking for a login, but after entering the credentials twice, you get the standard The server has rejected the client credentials
error.
The code I currently have is here (Just used to discover computers):
$password = Get-credential
Get-ADComputer -Credential "$password" -Filter 'Name -like "DESK*"' -Properties IPv4Address | FT Name,IPv4Address -A