Script to check credentials for multiple Windows machines.

Welcome Forums General PowerShell Q&A Script to check credentials for multiple Windows machines.

Viewing 5 reply threads
  • Author
    Posts
    • #193261
      Participant
      Topics: 1
      Replies: 3
      Points: -18
      Rank: Member

      Hi All,

      Can someone help me to get the simple script to check the credentials for multiple windows machines. and also if possible is their any script where credentials will be taken from notepad and check the credentials by its own instead of manual enter.

      Thanks,

      Kiran

    • #193309
      Participant
      Topics: 10
      Replies: 1381
      Points: 1,509
      Helping Hand
      Rank: Community Hero

      Did you attempt to search? My search "powershell test local user credentials" produced many results, like this one:

      https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/test-local-user-account-credentials

    • #193315
      Moderator
      Topics: 3
      Replies: 87
      Points: 464
      Helping Hand
      Rank: Contributor

      The Get-Credential cmdlet supports the -ComputerName parameter, which will allow you to run it against a remote system. A simple application of Foreach would allow you to loop through many remote systems.

      Test-Cred is an example of a script written to do exactly what you want – test the credentials of a user on remote systems. It can also store the credential for use within the same session. You would want to modify that script so that it passes the credential information to whatever other tasks you need to perform.

      However, this:

      and also if possible is their any script where credentials will be taken from notepad and check the credentials by its own instead of manual enter.

      is a very bad idea. You should never store credential information of any kind in static, un-encrypted files. Doing so effectively breaks your security. Think of it like making a copy of your house key and then leaving it lying around where other people can find it – you might as well just take the lock off your door.

    • #193631
      Participant
      Topics: 1
      Replies: 3
      Points: -18
      Rank: Member

      Did you attempt to search? My search "powershell test local user credentials" produced many results, like this one:

      https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/test-local-user-account-credentials

      Hi Rob,

       

      But i dont think i got the result which i was looking for in the given link

    • #193634
      Participant
      Topics: 1
      Replies: 3
      Points: -18
      Rank: Member

      Hi,

      Can someone help to fix the below issue for the given script

      Issue:- If i enter the wrong password also it is connecting , which is not supposed to be happened. I have multiple machines needs to be logged in .

      Below is the  Script i am using.

      $servers = Get-Content C:\Users\esxxkir\Documents\Scripts\Connectivitycheck\test.txt
      $cred = Get-Credential
      foreach ($server in $servers) {
      if(Test-Connection $server -Count 1 -ErrorAction SilentlyContinue) {
      if(New-PSDrive -Name testshare -PSProvider FileSystem -Root "\\$server\c$" -Credential $cred -ErrorAction SilentlyContinue)
      {
      $status = 'online and able to connect'
      Remove-PSDrive testshare
      }
      else {
      $status = 'online but unable to connect'
      }
      }
      else {
      $status = 'offline/not in DNS'
      }
      Write-Host $server – $status
      }

    • #193637
      Participant
      Topics: 1
      Replies: 3
      Points: -18
      Rank: Member

      The Get-Credential cmdlet supports the -ComputerName parameter, which will allow you to run it against a remote system. A simple application of Foreach would allow you to loop through many remote systems.

      Test-Cred is an example of a script written to do exactly what you want – test the credentials of a user on remote systems. It can also store the credential for use within the same session. You would want to modify that script so that it passes the credential information to whatever other tasks you need to perform.

      However, this:

      and also if possible is their any script where credentials will be taken from notepad and check the credentials by its own instead of manual enter.

      is a very bad idea. You should never store credential information of any kind in static, un-encrypted files. Doing so effectively breaks your security. Think of it like making a copy of your house key and then leaving it lying around where other people can find it – you might as well just take the lock off your door.

      I agree for your point but if we have bulk machines with different Passwords how to work on it. If you have any script at least that should for me to enter once my credentials and get the output whether machines are able to connect or not.

      Thanks,

      Kiran

Viewing 5 reply threads
  • You must be logged in to reply to this topic.