Hello,
Please to help me.
How to create a script for this: Create a non-interactive PowerShell script that accepts the following parameters on the command line:
a. ProjectStart
b. ProjectEnd
c. PhaseStart
d. PhaseEnd
So, if the user supplied 1, 3, 1, and 2 as corresponding parameter values, then the following folder
structure shall be created:
C:\Projects\Project1\Phase1
C:\Projects\Project1\Phase2
C:\Projects\Project2\Phase1
C:\Projects\Project2\Phase2
C:\Projects\Project3\Phase1
C:\Projects\Project3\Phase2
The background is as follows. I have to write it for homework (Homework - Scripts and Command Line)
Main goal is to create two PowerShell scripts. This time aren’t any specific requirements about the infrastructure.
Tasks
Do the following:
1. Create an interactive PowerShell script that asks the user for:
a. First name
b. Last name
c. Password
And based on the user’s input creates:
- AD user with SamAccountName with the following format First_name.Last_name
- Personal (named) folder in C:\Shared on the computer where the script is executed
For example if user executed the script on the DC and entered for first name Name, for last name LastName,
and for password Password1, then a new AD user with SamAccountName equal to FirstName.LastName will be
created. In addition, a new folder C:\Shared\FirstName.LastName will be created as well.
Then the script should ask the user if he/she wants to create another user or no.
2. Create a non-interactive PowerShell script that accepts the following parameters on the command line:
a. ProjectStart
b. ProjectEnd
c. PhaseStart
d. PhaseEnd
So, if the user supplied 1, 3, 1, and 2 as corresponding parameter values, then the following folder
structure shall be created:
C:\Projects\Project1\Phase1
C:\Projects\Project1\Phase2
C:\Projects\Project2\Phase1
C:\Projects\Project2\Phase2
C:\Projects\Project3\Phase1
C:\Projects\Project3\Phase2
Proof
Send/attach the scripts
Ahh. Then you should definitely try writing some code yourself based on training you have attended. Getting a direct solution from any forums will defeat the purpose of the course .
Try putting up some code, it should be easy for this task for sure. Folks here will definitely help if you have some code .
So, where did you get this code then? It does not help you if you don’t understand the code.
You have an outer loop with its variable $i and you have an inner loop with its variable $j. And you should use them to create the desired directories. … that’s not that hard to understand.