generate password if password is empty#16
generate password if password is empty#16Plork wants to merge 3 commits intoRamblingCookieMonster:masterfrom
Conversation
also didn't take into account that Password wouldn't be in $PSBoundParameters.
|
I can't test this at the moment. |
|
Only problem with this I had was the $script scoped Templates variable I Op ma 26 sep. 2016 om 07:06 schreef Joel Bennett notifications@github.com:
|
|
the Templates variable is a script scoped variable. I guess this is so you don’t have to get the templates everytime. This has a weird side effect tho I can’t explain. A noteproperty gets added with to $Field with the values of the input parameters. Somehow these extra properties get added to the $script:secretTemplates as well. So the template in the script scope gets the values that are added to $field. I would have thought that because you create a new variable $fields = $Template.Fields it would “copy” the $template variable into a new one and the the original does not gets altered. I say this because I edited the script to allow to leave the password field empty. That way thycotic wil generate a password based on the requirements specified in the template. (So I don’t have to generate a password myself.) But because the script scoped $secretTemplates got the values of the $Fields variable the 2nd time I run the script the values of the first loop are still in there. My “if password is empty” fails because of this. (it’s only empty the first iteration). |
see https://thycotic.force.com/support/s/article/PowerShell-Add-Update-Secret-Example for example.