Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate password if password is empty #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Plork
Copy link
Contributor

@Plork Plork commented Sep 13, 2016

@Plork Plork changed the title generate password is password is empty generate password if password is empty Sep 13, 2016
also didn't take into account that Password wouldn't be in $PSBoundParameters.
@Jaykul
Copy link
Collaborator

Jaykul commented Sep 26, 2016

I can't test this at the moment.

@Plork
Copy link
Contributor Author

Plork commented Sep 26, 2016

Only problem with this I had was the $script scoped Templates variable I
mailed you about. I removed it locally and then this works.

Op ma 26 sep. 2016 om 07:06 schreef Joel Bennett [email protected]:

I can't test this at the moment.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEBGLxgNpYxvMz8p8XagGp_vVFwQ3FUoks5qt1LHgaJpZM4J8Hr8
.

@Plork
Copy link
Contributor Author

Plork commented Sep 26, 2016

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants