Hey folks,

I'm trying to set a local admin password with a random value in OSD. I found 
this function online that is great, but I can't seem to return the value 
outside the function. I've tried a bunch of ways with no luck. Can someone 
help? The colde below doesn't have the setting of the password, I just want to 
see that the password variable is returning and I can use it in the change 
command.

Function GET-Temppassword() {

Param(

[int]$length=10,

[string[]]$sourcedata

)


For ($loop=1; $loop -le $length; $loop++) {

            $TempPassword+=($sourcedata | GET-RANDOM)

            }

return $TempPassword  <-- this value does display

}

$ascii=$NULL;For ($a=33;$a -le 126;$a++) {$ascii+=,[char][byte]$a }
$PW = GET-Temppassword -length 19 -sourcedata $ascii

write-host $PW  <-- this is empty


Best Regards,

Mike Murray
Desktop Management Coordinator - IT Support Services
California State University, Chico
530.898.4357
[email protected]<mailto:[email protected]>




Reply via email to