Question
Create a script in windows PowerShell to add active directory users. Your script needs to do the following (SEE BELOW FOR HINTS): -It will start
Create a script in windows PowerShell to add active directory users. Your script needs to do the following (SEE BELOW FOR HINTS):
-It will start off by asking how many users youd like to add (Hint- store the value entered as a variable called $number)
-Next, youll use a while loop
-In the while loop youll need to ask the user for an input of each of the switch parameters (the parameters with a before them)
youll need a variable for name, given name, surname, user principal name and sam account name.
-after getting values for each of these variables from the user, your while loop will need to build the user in using New-ADuser, but youll need to use the variables as the parameters.
-your while loop will then need to prompt for a password and then youll need to set the password to the user.
-Finally, your while loop will need to enable the active directory account you just created.
Hints:
-Figure out how to store the user input number as a variable.
-Figure out how to capture user input and store as variables (like what you did above for the user input number) then pass these variables as parameters. As an example, ask your user to type in the account name and save it as $name.
Then, when you run New-ADUser use the parameter -name $name. DO THIS FOR ALL OF THE PARAMETERS NEEDED TO ADD A USER, not just name.
-Next, figure out how to create a while loop that starts with a number ($number) and decreases by 1 until it reaches zero.
-once you know how to do these 3 things, complete your script- first prompt for the number of users, then run your while loop (starting with $number and subtracting 1 each time until you reach zero). In the while loop youll prompt for user input of each of the parameter variables, then youll use those variables to add a user using New-ADUser.
-Prompt the user for a password, then assign the password to the user and enable the account.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started