The ascii range for numbers 0-9 is <48-57>, so something like this?

$pass = "your convention"
$a = ([char[]](Get-Random -Input (48..57) -Count 4)) -Join ''
$password = $pass + $a

- Sean

On Tue, Jun 28, 2016 at 8:57 AM, Christopher Baio <[email protected]> wrote:

> I need to programmatically auto generate them, but they must follow my
> convention.  The password will need to contain four random digits 0-9.
>
> - Chris
>
>
> ------------------------------
> From: [email protected]
> To: [email protected]
> Subject: RE: [NTSysADM] Create random password
> Date: Tue, 28 Jun 2016 16:48:06 +0000
>
> Are you looking to programmatically auto generate those passwords? Or just
> a way to get 300 at a time that you manually add to the CSV file?
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *geoff_taylor geoff_taylor
> *Sent:* Tuesday, June 28, 2016 11:29 AM
> *To:* ntsysadm <[email protected]>; Christopher Baio <
> [email protected]>
> *Subject:* Re: [NTSysADM] Create random password
>
>
> If read you correctly you already have a script that pulls from a csv.
> You could just add a new column to the csv and pre-populate that with
> randomly generated passwords in your favourite spreadsheet program, then
> modify your script to pull that in as well.  Lots of random password
> formulas for spreadsheets on the web.
>
> gt
>
> ---------- Original Message ----------
> From: Christopher Baio <[email protected]>
> Date: June 28, 2016 at 10:35 AM
>
> I have a powershell script to create user accounts in a specific OU that
> will pull from a .csv.  That script sets variables for the user, one of
> them being a password that you specify in the script.  What I need to do is
> use a script to create the 300 users, but have a different password for
> each user.
>
> We have a naming convention for the password; just trying to figure out
> the best way to do this.  Any suggestions?
>
> Thanks
>
> - Chris
>
>
>
>
> ------------------------------
> ----------------------------------------- This message, and any
> attachments to it, may contain information that is privileged,
> confidential, and exempt from disclosure under applicable law. If the
> reader of this message is not the intended recipient, you are notified that
> any use, dissemination, distribution, copying, or communication of this
> message is strictly prohibited. If you have received this message in error,
> please notify the sender immediately by return e-mail and delete the
> message and any attachments. Thank you.
>

Reply via email to