1.

Solve : Automaticly create users and assign to groups batch script?

Answer»

For my GCSE Computing I need to find out how to automate the task of creating users and assigning them to groups. I will be using COMMAND prompt running on Windows XP (running through virtual box on windows 7).
I would like help with how to create, edit, save and run a windows batch script in cmd please.

The code should be mainly inside a loop which ALLOWS the user to repeat the process of creating and naming a user and assigning them to an existing group or a new group.

Any help/advice is much appreciated Quote from: thmoses on June 29, 2015, 01:25:52 AM

For my GCSE Computing I need to find out

It would help you to read about the subject, and try to automate some tasks - then come and
ask specific questions about THINGS you find difficult.

Here is the Linux task I need to change to work on MS-DOS:

"13. Linux enables tasks which are regularly carried out to be automated through the use of shell scripts. Plan write and test a shell script that could automate the task of creating new users and assigning them to groups."

This is the task I am currently on:

"14. Discuss how some of these tasks could have been done in a computer system running Windows or another operating system."
For this task I need to do some primary research, which is why I am here.

Here is the pseudo code for the task that I wrote:

Repeat = 1 #This initializes the repeat variable
Counter = 0 #This initializes the COUNT variable
WHILE repeat = 1 #This starts an iteration of something while the repeat variable is 1
   OUTPUT “Please enter the username for the new user”
   INPUT = username
   Add the user username
   Counter = counter + 1
   WHILE repeat = 1
      OUTPUT “Please enter the name of the group for the new user”
      INPUT = group
      IF the group ALREADY exists THEN
         Add username to group
         Repeat = 0
      ELSE
         OUTPUT “The group group does not exist.”
OUTPUT “Do you want to create it as a new group (Y)”
OUTPUT “Or enter another group to add the user username to (N)?”
         IF INPUT = Y THEN
            Create group called group
            Add username to group
            Repeat = 0
         ENDIF
      ENDIF
   ENDWHILE
OUTPUT “username has been added to the group group”
OUTPUT “Do you want to create another user? Y or N”
IF INPUT = N THEN
      Repeat = 0
ELSE
   Repeat = 1
ENDIF
ENDWHILE
OUTPUT “You have successfully created counter more users and added them all to groups.”


Here is the linux code:




----------------------

I would like to know some starting tips on how to write something like this using the MS-DOS please. The thread may be closed if you want someone to do your course work for you.

Asking specific questions is probably fine.Sorry, we won't do your homework for you.


Discussion

No Comment Found