Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.Creates the following folder structure on the C:\\ drive of your computer: Scr

ID: 3646535 • Letter: 1

Question

1.Creates the following folder structure on the C: drive of your computer:
Scripts_New
Networking
User
Management


In this script the Networking, User , and Management folders should be in the Scripts_New folder
List the contents of the Scripts_New directory and export to dir.txt file


2.Deletes the folder Scripts_New structure created in the previous step.


3.Creates a file named users.txt
Adds the following lines to the users.txt file:
ckent,Clark Kent,1Ppassword3
bwayne,Bruce Wayne, 2Password!


Opens the file using the default application for the file


4.Set the attributes of the users.txt file to hidden and archive.


5.Reads the users.txt file assigns it to the variable $file
Loops through the variable $file using a foreach statement and the dummy variable $user to read each line from the array $file.
In the script block of the foreach statement do the following:
Use the split method of the string object $user to split the line at the comma and assign this value to the variable $user_info
Create a user account with the information in the $user_info array and the net user command

Explanation / Answer

Part 1)


New-Item -ItemType Directory -Force -Path C:Script_new

New-Item -ItemType Directory -Force -Path C:Script_newNetworking

New-Item -ItemType Directory -Force -Path C:Script_newUser

New-Item -ItemType Directory -Force -Path C:Script_newManagement



$items = Get-ChildItem -Path "C:Script_new"

foreach ($item in $items)

{

# if the item is a directory, then process it.

if ($item.Attributes -eq "Directory")

{

Write-Host $item.Name

}

}