From d660bdd9bf5d920887ae4fffe94980668c32dcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Wed, 21 Oct 2015 20:06:57 +0200 Subject: [PATCH] Also replaced first and last names --- Commissions/Fredrik/Make Users.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Commissions/Fredrik/Make Users.ps1 b/Commissions/Fredrik/Make Users.ps1 index 0ed97d5..8e7c7c5 100644 --- a/Commissions/Fredrik/Make Users.ps1 +++ b/Commissions/Fredrik/Make Users.ps1 @@ -6,11 +6,13 @@ $Users = Import-Csv .\Users.csv forEach ($User in $Users) { - $first = $User.first[0..1] - $last = $User.last[0..2] + $firstname = $User.first + $first = $firstname[0..1] + $lastname = $User.last + $last = $lastname[0..2] $username = "$first$last" $username = $username -replace " ", "" - "dsadd user `"cn=$username, ou=Illuminati, dc=datavg2, dc=local -fn Joetta -ln Heckel pwd Admin123" | out-file run.bat -Encoding "UTF8" -Append + "dsadd user `"cn=$username, ou=Illuminati, dc=datavg2, dc=local -fn $firstname -ln $lastname pwd Admin123" | out-file run.bat -Encoding "UTF8" -Append } "echo Script has finished running, thanks based Daniel in 1ELA for making our lives easier" | out-file run.bat -Encoding "UTF8" -Append "PAUSE" | out-file run.bat -Encoding "UTF8" -append