Sie sind auf Seite 1von 2

UEE40111 Certificate IV in Computer Systems

Net Admin Fundamentals 2


Units: ICANWK403A, ICANWK402A, UEENEED104A, ICANWK409A

336108406
1) PowerShell Tutorials
a. Start a ServerA (or another Windows Server 2012 R2 virtual machine that is a domain
controller it probably doesnt matter for earlier exercises, but it will later). You may want to
install guest additions so that you can cut and paste to your VM.
b. Signon as Superman
c. Run Windows PowerShell ISE
or
You could use just the PowerShell command line, plus an editor like notepad++, note if your
scripts are not local then also run: set-executionpolicy unrestricted
2) Install guest editions.
Share a folder from your host PC to your VM (VBox Manager | ServerA | Settings | Shared Folders).
Copy the following files from the Moodle to you host PC and then to you documents folder on
ServerA:
customer_feedback.txt
new_users.csv
Note: you could get the files onto ServerA by visiting the Moodle from ServerA, but you need to
demonstrate competent use of virtualization software.
3) Write and paste here a piece of code that:
Changes directory to you documents folders. Hint: use the variable $home

set-variable HOME "C:\Users\Administrator\Documents" force


4) Write and paste here a piece of code that:
Reads the content of the customer_feedback.txt file into a variable called $lines . Hint: use GetContent

$lines="C:\users\administrator\Desktop\customer_feedback.txt"
5) Write and paste here a piece of code that:
Reads the content of the customer_feedback.txt file into a variable called $lines
Loops through all the lines in $lines and prints out each line

foreach ($name in get-content $lines) {write-host $lines $name}


6) Write and paste here a piece of code that:
Reads the content of the customer_feedback.txt file into a variable called $lines
Loops through all the lines in $lines and prints out each line
While still in the loop, splits each line by the | character and stores the result in a variable called
$fields
Hint: use Split
While still in the loop, print the value of the second field (ie the score)
7) Write and paste here a piece of code that:
Reads the customer_feedback.txt file and prints out only the favorable comments (where the score
is 9 or better).

Page 1 of 2

UEE40111 Certificate IV in Computer Systems


Net Admin Fundamentals 2
Units: ICANWK403A, ICANWK402A, UEENEED104A, ICANWK409A

336108406
8) Write and paste here a piece of code that:
Reads in the content of the file new_users and stores it in a variable called $lines
Replaces the following strings
Replace LAB with the first part of the domain name that your server is using, eg Parts
Replace PRIVATE with the first part of the domain name that your server is using, eg Internal
Replace OU=LAB_USERS with the name of the OU where you store your users, eg PARTS_Users
Hint: look at the ireplace operator
Print $lines
9) Write and paste here a piece of code that:
As above, but when you are happy with the output,
save $lines to a file called my_new_users.csv . Hint: use set-content
10) Execute the following code, fix any errors and check what it does:
Import-Csv my_new_users.csv | New-ADUser

Signof
Position
Systems
Programmer
(student)
Client
(instructor)

Name &
Student Id
Ahmad Hijazi

Signature

Date
07/10/2015

H201405293
Nathaly Conlan

07/10/2015

Page 2 of 2

Das könnte Ihnen auch gefallen