Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

a variable plus a plaintext as password

$
0
0

Hi friends

in my test AD domain, i want to change the password of all user accounts.

on every user account properties, i have filled a test "employee ID" .

i need passwords of every user be set in this regulation:

 his employee ID end with @aA

i mean at the end of the all passwords, these three characters must be added:  @aA

for example imagine employeeID of User1 is '123'

his password must become 123@aA

i tried with the following command but i don't know how to combine the $employeeID variable with this plaintext @aA string

 

$OU ='ou=ou-users,dc=mydomain,dc=lab'Get-Aduser-filter *-searchbase $OU |foreach-object{ $EmployeeID =(Get-ADuser-identity $_ -properties *).Description; $pass = convertto-SecureString"$emplyeeID"-asplaintext -force

# my question is about the above line. i don't know what to write at the location of "$employeeID"

# i tested the following but doesn't result as expected ( i know i am not correct):

$pass = convertto-SecureString "$emplyeeID"+@aA -asplaintext -forceSet-ADAccountpassword-identity $_ -reset -newpassword $pass }

 

 

 

any help please?

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles