I have acode thatworks great.SoI readoutthe weak passwords.This way I canfindtheuserinformedto choosea secure password.How canIchange the codenowto requestmoreinsecure passwordsat the same time?So, for example,password1,password2,password..n??
The bestfrom a textfile thatI passthen.
Thx
[void][system.reflection.assembly]::LoadWithPartialName('System.DirectoryServices.AccountManagement')
$Searcher = [adsisearcher]''
$Searcher.Filter = '(&(objectclass=user) (objectcategory=person))'
$Searcher.PageSize = 500
$Searcher.FindAll() | ForEach-Object -Begin {
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
} -Process {
if ($DS.ValidateCredentials($_.properties.samaccountname, 'password')) {
New-Object -TypeName PSCustomObject -Property @{
samaccountname = -join $_.properties.samaccountname
ldappath = $_.path
weakpassword = $true
}
}
}