Test-Credential

https://www.powershellgallery.com/packages/Test-Credential

 
 
 
 
 
5 Star
(5)
2,762 times
Add to favorites
Active Directory
7/22/2016
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Possible typo
    1 Posts | Last post March 18, 2018
    • Good day.
      i think the following line
      $networkCredential = $Credential.GetNetworkCredential() 
      
      should look like this
      $networkCredential = $item.GetNetworkCredential()
      
  • Logged on with a Local Account testing Domain Credentials
    3 Posts | Last post January 22, 2018
    • I was in a situation where I didn't know what domain the user would need to test and whether or not they would be logged on local or not. The script works great but I had to make a modification to the domain parameter to fulfill the need. It'd probably be useful to update it as I think this works better than using the environment variable. Thanks dotps1 for saving me some time.
      
      [Parameter()]
      [String]
      $Domain = $Credential.GetNetworkCredential().Domain
    • thanks for the info, I updated the code, I don't typically update things here anymore, so I would recommend getting it form the PSGallery:  https://www.powershellgallery.com/packages/Test-Credential
      
      thanks.
    • Hey, I just used this script. I recommand to update the $Domain Parameter as a DynamicParam to allow Pipeline Support like Get-Credential | Test-Credential.
      [OutputType([Bool])] 
           
          Param ( 
              [Parameter( 
                  Mandatory = $true, 
                  ValueFromPipeLine = $true, 
                  ValueFromPipelineByPropertyName = $true 
              )]
              [Alias('PSCredential')] 
              [ValidateNotNull()] 
              [System.Management.Automation.PSCredential] 
              [System.Management.Automation.Credential()] 
              $Credential
          )
          DynamicParam {
              [String] 
              $Domain = $Credential.GetNetworkCredential().Domain 
          }
      
      Thanks :)