maxrebo Posted September 26, 2024 Posted September 26, 2024 As Per title, We need to set supply accounts to reset password on a daily basis and generate a random password + force password change- is there anything I can use for this? Thanks
3s-gtech Posted September 26, 2024 Posted September 26, 2024 (edited) Do you use Salamander? Otherwise, you can do it in Powershell, with a scheduled task. Creates a random 12 character string for the password then sets it. $password = -join (((48..57)+(65..90)+(97..122)) * 80 |Get-Random -Count 12 |%{[char]$_}) Set-ADAccountPassword -Identity [username] -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $password -Force) set-aduser [username] -ChangePasswordAtLogon:$true My Powershell is poor, but this should work. Test it. https://gist.github.com/gregjhogan/2350eb60d02aa759c9d269c3fc6265b1 Edited September 26, 2024 by 3s-gtech 1
djm968 Posted September 26, 2024 Posted September 26, 2024 Where are the accounts? For AD accounts, you should be able to use a script run as a scheduled task. Take a look at this. https://www.edugeek.net/forums/scripts/233031-password-reset-via-csv.html
imailuk Posted March 10, 2025 Posted March 10, 2025 You could use Powershell and the API here: https://pwd.woodsfamily.uk There's API instructions for obtaining passcodes using Powrshell. Generated passcodes can be stored for retrieval as .csv from the site, take a look and see what you think?
Oaktech Posted March 10, 2025 Posted March 10, 2025 Before I moved to the cloud, this ran as a scheduled task on my DC each night... ### Generates a request via the DinoPass API for a random simple password $Password_Part1 = Invoke-WebRequest -Uri https://www.dinopass.com/password/simple | Select-Object -ExpandProperty content ### Generates a date in day-2digitmonth-4digityear $Password_Part2 = Get-Date -format "dd-MM-yyyy" ### Concatenates the 2 into one variable $Password_Complete ="$Password_Part1$Password_Part2" ### Writes the output to text file so you have a local reference - can be omitted. $Password_Complete | Out-File C:\YourFileLocation\value.txt ### Resets the specified account password to the value contained within $Password_Complete Set-ADAccountPassword -Identity UserName -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "$Password_Complete" -Force) ### Emails the new password ### Email address to send from $username = "[email protected]" ### Email Password $Password = "ComplexEmailPassword" ### Converts plaintext password above to a secure string $Password = ConvertTo-SecureString -String $Password -AsPlainText -Force ### Creates a credential object to call later $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $Password ### Specifies email subject $subject = 'Alert: New Password' ### Specifies Email body $body = $Password_Complete ### Splatting with Hash Table $hash = @{ To = '[email protected]' From = $username Subject = $subject Body = $body BodyAsHtml = $true SmtpServer = 'smtp.office365.com' UseSSL = $true Credential = $cred Port = 587 } ### Sends Mail Send-MailMessage @hash -WarningAction Ignore Email was sent to the office email account as they were the one's who did meet n greet with supply staff. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now