I've been playing around with a powershell way of doing it. Please use at your own risk
A few things:
- -AsPlainText option is for Encrypted Passwords.
- This displays it to the user and also logs it. So you'll see the password in the logs. Unless you want to turn off logging for Powershell scripts.
Import-Module Adaxes
# Get computer domain name
$domainName = $Context.GetObjectDomain("%distinguishedName%")
$searchresults = Get-LapsADPassword -identity "%cn%" -AsPlainText
$name = $SearchResults.ComputerName
$password = $SearchResults.Password
$passupdate = $SearchResults.PasswordUpdateTime
$Context.LogMessage("ComputerName: " + $name, "Information")
$Context.LogMessage("Password: " + $password, "Information")
$Context.LogMessage("Last Password update: " + $passupdate, "Information")
As another option I was thinking of just writing to a file on a server and cleaning up the directory daily until I can find a better option to not to display this and not Log the password.