I'm trying to write a script that will automatically pass the new password as a variable but for some reason Powershell is still prompting for the password. I'm trying to automate this through Jenkins, but Jenkins keeps erroring out saying Powershell is running in "Noninteractive Mode"
Here is my code:
import-module activedirectory
$pass = "NewPassword"
$username = "Username"
$newpass = ConvertTo-SecureString $pass -AsPlainText -Force
Set-ADAccountPassword -Identity $username -NewPassword $newPassword -Reset
In the Actual jenkins config I wont have these static "Username" and "Password" fields, they will be replaced with environment variables. based