Batch file / Scripting Windows Need Help

January 7, 2019 at 13:00:42
Specs: Windows 10
I'm new to scripting need help creating a batch file that does the following i have instructions on what the batch file should contain and do.

All batch files must be formatted for readability. Include documentation that clearly states the purpose of the batch file, the author and, the purpose of any sections and the purpose of any IF statements. As always,include the batch file’s text and a sample execution within a word document as well as a zipped copy of the
batch files.

1)
Create a batch file named IFLOOP that uses an IF statement and a Counter to control the number of times a loop is executed. The number of times the loop must be executed depends on the current month. If the current month is June, since this is the 6th month in the year, the loop must execute 6 times. If the month is December, the loop must execute 12 times, etc.The value of the current month must be extracted from the system date. Each iteration of the loop must set the month’s name in a variable named monthname and must display the value of the counter as well as the value of the monthname variable. For example, if the current month is May, the loop’s output would look like this:

1 January
2 February
3 March
4 April
5 May

The batch file must work for all months.Simple IF statements can be used. If you use nested IF statements you will need to address the issue of delayed expansion.

2)
Modify the IFLOOP batch file to use a FOR/L statement to accomplish the same thing that the IFLOOP batch file accomplishes. The batch file’s name must be FORLOOP. The output should be identical to the output generated by the IFLOOP batch file. I covered two approaches to handling SET commands within a FOR DO loop. You must use one of the methods covered to complete the problem: use a subroutine or enable delayed expansion.

3)
This batch file must be created on one of your virtual machines. Please indicate, as part of your
submission, the virtual machine you used to complete this problem.

This batch file has many of the same requirements as the useradd.bat from homework #2. You can modify that batch file or create a new one from scratch. This batch file’s name must be
NEWUSER.BAT.

• The batch file must create user accounts on the local computer.

• Since this task requires administrative rights, the first thing the batch file should do is confirm
that the command prompt is opened in elevated mode. If it is, then the batch file should
continue, if it isn’t, then an appropriate message should be presented to the user and the batch
file should end. Any messages presented in this part of the batch file should be generated by
you; no system messages should be displayed.

• Each user account must be created with a username, password and a value in his/her full name property. The full name property must include the user’s first and last name.

• The batch file must prompt the user for each value (username, password and full name).
(Set /P required)

• The batch file must include a loop which allows multiple user accounts to be created;
one iteration of the loop should process one user.

• Before creating the user account, you must check if the account already exists. If the account
already exists, display an informative message to the user and continue looping. If the account
doesn’t exist yet, create it and display an appropriate message indicating that the user was
successfully created. The only messages that should be displayed in the output are those that
you provided; no system messages should be displayed.

• After successfully adding a user the batch file must include a prompt which asks the person
running the batch file if he/she wants to add this user to the localAdministrators group. If the
user answers yes, the batch file must make the user a member of that group and then continue
looping. If the user answers no, the batch file should continue looping. You must also validate
the user’s response; make sure that their response is either Y or N. If neither is entered then
display an error message and ask them to input a valid response

• Afteradding a user (or attempting to add the user) the batch file must include a prompt which
asks the person running the batch file if he/she wants to add another user. If the user answers
No, the batch file should end; if the user answers Yes, the batch file should continue. You must also validate the user’s response; make sure that their response is either Y or N. If neither is entered then display an error message and ask them to input a valid response

When submitting: In addition to the normal requirements, include the following:

• The sample execution must include at least 2 loop iterations

•At least one iteration must answer yes to being added to the administrator’s group.

•Identify what Virtual machine you used and the absolute path to the batch file on the virtual
machine. I will test it.

4) Create a batch file named USERNEW.BAT that creates user accounts on the local computer.

• The batch file must create user accounts on the local computer using a text file that you’ve
created as input. The text file must include the username, the user’s password, the user’s fullname as well as an additional ‘field’ that includes either the letter Y or the letter N (I’ll refer
to this field as the AdminGroup field.) This letter will be used to determine whether or not to
make the user a member of the local administrator’s group. This text file must be created by you outside the batch file (in other words, the batch file is not creating this file, it’s going to use it as input).

• Since this task requires administrative rights, the first thing the batch file should do is confirm
that the command prompt is opened in elevated mode. If it is, then the batch file should
continue, if it isn’t, then an appropriate message should be presented to the user and the batch
file should end. Any messages presented in this part of the batch file should be generated by
you; no system messages should be displayed.

• Each user must be created with a username, password and a value in his/her full name property.

• The full name property must include the user’s first and last name.

• The batch file must use the FOR /F command and must get each value (username, password,full name and the AdminGroup field ) from a text file created by you.

• After successfully creating the user, if the letter Y exists in the AdminGroup field for the user,
add the user to the local administrator’s group.

• As each user is created, the batch file must display a well formatted message which states that the user was created and must display the username, password, full name and a list of the local group memberships that the user belongs to. The text file must provide information for at least 5 users


See More: Batch file / Scripting Windows Need Help

Report •

#1
January 7, 2019 at 14:26:36
Pretty sure you should talk to your professor about your difficulties with your homework, instead of asking the Internet to do your work for you.

How To Ask Questions The Smart Way


Report •

#2
January 7, 2019 at 14:53:27
Don't we all request for some sort of help through the internet whether is troubleshooting or help with some configurations. At some point i bet you was at a situation where you needed help and someone else was being a stick in the mud about it.

message edited by QuantumTech


Report •

#3
January 7, 2019 at 14:59:29
Not for homework. Your homework is for you to do. What's going to happen when your professor quizzes you on batch files? Do you expect me to walk in to your classroom and take your test?

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
January 7, 2019 at 15:04:48
Quizzes don't outweigh the homework in some courses. Why you so angry about someone reaching out for help mr. perfect, i'm not asking you to take the test for me.

Report •

#5
January 7, 2019 at 15:13:12
Oh, I'm not angry. Just stonewalling. I don't know you, so there's no real way you can upset me. I'm also voicing the common opinion of this site. We've seen our share of students trying to get us to do their homework. I even had a canned response. I think I lost it some time ago. I had to dig into this site's archives to get it again. If you prefer, you can just mentally replace my first response with the below.


Awesome. When you get past the, "Have the Internet do my homework for free" stage, let us know.

If you start doing your homework yourself, but run into problems, feel free to ask us. Make sure to include the code you're having problems with.

If you prefer to have the Internet do your homework, well, that's an option, too.

How To Ask Questions The Smart Way


Report •

#6
January 8, 2019 at 04:44:59
I will replace your first initial responses with this one. I'm not a big fan of scripting and i won't be having a career where scripting is part of my daily objective. I can agree with you i will share my code when the time comes. This is my first time approaching the internet in this manner, i'm an old fart. I also heard that 80% of college student at some point in their college semester approach the internet with the "Have the internet do my homework for free" stage. I apologize for this approach honestly.

Report •

Ask Question