forms - New-ADuser echo user password -


attempting set powershell form creates new user in our ad, script works great being contractors need echo password input , save csv exporting. below have far

new-aduser -name "$d" -accountexpirationdate "$j" -accountpassword (read-host assecurestring "enter password below") 

secure strings aren't secure 1 might think. read password variable instead of putting read-host in subexpression:

$pw = read-host -assecurestring -prompt "password" new-aduser -name "$d" -accountexpirationdate "$j" -accountpassword $pw 

and can decrypt secure string this:

$cred = new-object management.automation.pscredential ('x', $pw) $cred.getnetworkcredential().password 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -