PowerShell Guru - Request
I'm curious if any of the PowerShell Guru's would help me with a request.
I have a script I use once in awhile that I'd like to be setup in a GUI style.
Script just "extends" the users password. Basically just resets the Last Reset Date. Currently I have to "edit" and then enter the username, save it then run the script. I'd love it if I could just have a Username Box and a Run Button so i can just open it up type the username, and hit run then it executes the script. Any takers for help ?? :)
Import-Module ActiveDirectory
$users = "gerdesa" # enter USERNAME
foreach ($user in $users)
{
Get-ADUser $user | Set-ADAccountControl -PasswordNeverExpires $false
$TargetUser = Get-ADUser -Filter {sAMAccountName -eq $user}
$uObj = [ADSI]"LDAP://$TargetUser"
$uObj.put("pwdLastSet", 0)
$uObj.SetInfo()
$uObj.put("pwdLastSet", -1)
$uObj.SetInfo()
}
Comments
.NET 4.5.2 currently on that server.
Interesting. Is it happening when you launch the utility or when you Press the button to execute the code?
Won't even let you launch it. Soon you open the .exe it pops up. I can try to push out .NET 4.6.1 and see if that makes a difference!
Ok. I've got a Server 2008 R2 box still laying around. I'll do some testing and see if I can't fix it.
Fix is on my GitHub in the Sadler 2.0 folder.
2.0 worked like d a charm on 2008 R2 ...I'll continue using the first version for the 2012 server !
2.0 should be good for both servers. It's backwards compatible. That way you don't have to keep 2 versions laying around. But that's up to you :)
Glad it is working for ya.
and the spiderman looking logo ... Aaaamazing.
Well I tried the 2.0 on the Server 2012 and it gave an error about missing 3.5 .. so I just kept the orginal on it :)