Beitrag

Powershell AD PMC Reset Script

Little dirty helper to prevent forced password change after x day. don’t let the admin know.😉

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Import-Module ActiveDirectory
Clear-Host
# txt file with usernames
$TXTFile = "C:\Users\user\Desktop\txt.txt"
$Accounts = @()
@(gc $TXTFile) -match '\S'|out-file $TXTFile
$Accounts = Get-Content $TXTFile
foreach($account in $Accounts){
Get-ADUser -Identity $account -Properties * | Select-Object Displayname, PasswordLastSet
Set-ADuser -Identity $account -ChangePasswordAtLogon $True
Set-ADuser -Identity $account -ChangePasswordAtLogon $False
}
 
Echo ""
 
foreach($account in $Accounts){
Get-ADUser -Identity $account -Properties * | Select-Object Displayname, PasswordLastSet
}
Dieser Eintrag ist vom Autor unter CC BY 4.0 lizensiert.