Toolbox for AD Password change

Hi everyone,

Was hoping someone could give me a hand with regards to the SimpleHelp API. Likely I’m doing something wrong or what I wanna do just isn’t possible. I have the following toolbox:

$password = ConvertTo-SecureString “" -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential ("
*”, $password )
New-PSSession -ComputerName *** -Credential $cred

$sam=ServerUtilsAskTech (Login,text,username)
$newpass=ServerUtilsAskTech (Domain Password,password)

Set-ADAccountPassword -Identity $sam -NewPassword (ConvertTo-SecureString -AsPlainText “$newpass” -Force) -Reset

It doesn’t appear like ServerUtilsAskTech actually stores the inputted information as the specified variable so the script breaks. It should be noted that it works if I hardcode the user and pass for the account in the script but it kind of defeats the purpose.

Thanks

So it looks like this solves my problem (no variables for the api input):

$password = ConvertTo-SecureString “12367c5B” -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential (“thomas”, $password )
New-PSSession -ComputerName Hamilton-DC1 -Credential $cred

Set-ADAccountPassword -Identity ServerUtilsAskTech(samAccount,text) -NewPassword (ConvertTo-SecureString -AsPlainText “ServerUtilsAskTech (Domain Password,password)” -Force) -Reset

Hope it helps someone :slight_smile: