标签:PowerShell AD
验证用户名和密码通常会在内部进行定期扫描,以防止弱密码的使用。Add-Type -assemblyname system.DirectoryServices.accountmanagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine,"localhost")
$DS.ValidateCredentials("admin", "P@ssw0rd")
这里的验证会直接返回True或False,即是否通过验证
标签:PowerShell AD
原文地址:http://blog.51cto.com/2902744/2122024