Common
Passwörter für AD-Benutzer
6. Juni 2012
0

Powershell

#First, you need to import ActiveDirectory Module
Import-Module ActiveDirectory
#Second, generate a SecureString which contains the password.
$securePwd = ConvertTo-SecureString -String "[email protected]!" -Force -AsPlainText
#Third, find the Active Directory users ,and use Set-ADAccountPassword for resetng the password.
Get-ADUser -Filter {Name -like "Test*"} | Set-ADAccountPassword -NewPassword $securePwd

 

Powershell Skript

## Password Reset ##
# Specify the OU.
$OU = [ADSI]"LDAP://<OU>"

# Enumerate all objects in the OU.
$arrChildren = $OU.Get_Children()
ForEach ($User In $arrChildren)
{
    # Only consider user objects.
    If ($User.Class -eq "user")
    {
        # Set password.
        $User.Invoke("SetPassword", "pAs$w0rd")
        # Expire the password.
        User.pwdLastSet = 0
        $User.SetInfo()
    }
}

Schreibe einen Kommentar

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.