4/15/2018 Quiz: Test3 – Canvas – CSU
Assume that the Powershell Get-ADUser cmdlet returns references to zero or more user objects and that each object has at least the following attributes (possible example data is also shown for each of these attributes):
SAMAccountName – BrownSa
CN – BrownSa
DistinguishedName – CN=BrownSa,CN=Users,DC=CIS620,DC=Net UserPrincipalName – BrownSa@CIS620.Net
Name – Sally Brown
Surname – Brown
GivenName – Sally
Enabled – True
Question 2 2 pts
Give the single Powershell command-line that should be typed to get full help on a script called Run-MyScript.ps1.
I have not given, received, or used any unauthorized assistance, nor will I give, receive, or use any unauthorized assistance. (You must answer True to this in order to receive any credit for this test.)
True False
https://colostate.instructure.com/courses/62572/quizzes/101669/take
2/12
4/15/2018 Quiz: Test3 – Canvas – CSU
Question 3 3 pts
Write the single Powershell statement using Get-ADUser that will determine the number of user accounts that are in the currently logged-on system and store this number into a variable called $numAccounts.
HTML Editor
12pt
Paragraph
p
Question 4 5 pts
This question has two parts
1) (2 pts) Write the single Powershell statement using Get-ADUser that will retrieve references to all the user accounts on the currently logged-on system and store them into a variable called $accounts.
2) (3 pts) Give 2 Powershell commands for showing just the SAMAccountName information for all the accounts that are referenced in the $accounts variable (see first part of this question), one without using piping and one using piping.
HTML Editor
https://colostate.instructure.com/courses/62572/quizzes/101669/take
3/12
4/15/2018 Quiz: Test3 – Canvas – CSU
12pt Paragraph
p
Question 5 3 pts
Write the single Powershell statement that will use Get-ADUser to retrieve a user whose SAMAccountName is currently stored in the variable $accountName and store a reference to this account in a variable called $thisAccount.
HTML Editor
12pt Paragraph
https://colostate.instructure.com/courses/62572/quizzes/101669/take
4/12
4/15/2018 Quiz: Test3 – Canvas – CSU
p
Question 6 14 pts
This question has 3 parts.
Assume we have a DN hierarchy structure that looks like the following: DC=Net
DC=OurCourse OU=Area1
OU=Accounts OU=Staff
OU=Students OU=Area2
OU=Accounts OU=Faculty OU=Staff OU=Students
NOTE: There could be other account categories (OUs) besides Students, Faculty, and Staff, as well.
https://colostate.instructure.com/courses/62572/quizzes/101669/take
5/12
4/15/2018 Quiz: Test3 – Canvas – CSU
Accounts are created within the respective OUs, and each account’s CN (Common Name) and SAMAccountName all have the same value. Some sample DNs are listed here:
CN=SmitD,OU=Faculty,OU=Accounts,OU=Area2,DC=OurCourse,DC=Net CN=SmitC,OU=Faculty,OU=Accounts,OU=Area2,DC=OurCourse,DC=Net CN=SmitS,OU=Staff,OU=Accounts,OU=Area1,DC=OurCourse,DC=Net CN=SmitH,OU=Students,OU=Accounts,OU=Area1,DC=OurCourse,DC=Net CN=BrowSa,OU=Students,OU=Accounts,OU=Area1,DC=OurCourse,DC=Net
1) (5 pts) Write the Powershell command-line that will use Get-ADUser to retrieve all the students and store references to them into a variable called $studentsAll. (Remember that the Filter for Get-ADUser is “brain dead” when it comes to filtering on DistinguishedName with wildcards, so you have to pipe the output of Get-ADUser to Where-Object and phrase the DN “filter” with wildcards there instead.)
2) (4 pts) Write the Powershell command-line that will use Get-ADUser to retrieve all the students in Area2 and store references to them into a variable called $studentsArea2. (Remember that the Filter for Get-ADUser is “brain dead” when it comes to filtering on DistinguishedName with wildcards, so you have to pipe the output of Get-ADUser to Where-Object and phrase the DN “filter” with wildcards there instead.)
3) (5 pts) Assume that references to all the users (no matter what category) are in a variable called $usersAll. Write the Powershell command-line that will pipe the information in $usersAll to the Where-Object command to get just the users who are not students, and store these into a variable called $usersNotStudents.
HTML Editor
12pt Paragraph
https://colostate.instructure.com/courses/62572/quizzes/101669/take
6/12
4/15/2018 Quiz: Test3 – Canvas – CSU
p
Question 7 9 pts
This question has 3 parts.
Assume that we have VMware virtual machines and can access their snapshots via the
Get-Snapshot VMware/Powershell PowerCLI cmdlet. The syntax for using this cmdlet is: Get-Snapshot [[-Name]
[-Server
This can be used to retrieve any snapshots that exist on the VMware VCenter Server system.
New-Snapshot is also available, and it can be used for creating snapshots:
New-Snapshot [-VM]
1) (3 pts) Write the line of code that will get the snapshot(s) for the VM referenced in the $vm variable on the currently-connected default VIServer and store any resulting references into a variable called $snapshots. (You can force $snapshots to be an array even if there is only a single item in it, if you enclose the call to Get-Snapshot inside the @() operator – put the Get-Snapshot cmdlet and any parameters inside the parentheses.)
2) (1 pts) Assume that the variable $snapshots is an array of references to VMware snapshots. Write the single line of Powershell code that will tell us how many snapshots
https://colostate.instructure.com/courses/62572/quizzes/101669/take
7/12
4/15/2018 Quiz: Test3 – Canvas – CSU
there are in the $snapshots array variable.
3) (5 pts) Assume you want to create snapshots for all the VMs that are referenced in the variable $vms. In a nicely-formatted / readable manner (multiple lines, appropriate indenting), write the code that would take each VM in $vms, pipe it to a ForEach-Object block, and, in this block create a snapshot called “Test3-Snapshot” and send the reference to the VM to the output stream. Do all this asynchronously, quiescing memory in the process.
HTML Editor
12pt
Paragraph
p
Question 8 2 pts
Which of the following gives a true/false value telling whether the immediately previously run command ran successfully or not?
$? $LASTEXITCODE $error
Catch
https://colostate.instructure.com/courses/62572/quizzes/101669/take
8/12
4/15/2018 Quiz: Test3 – Canvas – CSU
Question 9 2 pts
Which of the following lets you determine what specific error or errors occurred when running a script or command?
$? $LASTEXITCODE Catch
if
Question 10 2 pts
Which of the following allows us to potentially communicate with any of a number of machines in a Local Area Network, even if there is only a single global/public IP address available for that LAN?
TCP/IP OSI SNAT ARP DNAT
Question 11 2 pts
Which of the following is being performed when we change port numbers and/or IP addresses in packets where communication is initiated from within a local area network?
https://colostate.instructure.com/courses/62572/quizzes/101669/take
9/12
4/15/2018 Quiz: Test3 – Canvas – CSU
TCP/IP OSI SNAT ARP DNAT
Question 12 2 pts
1. Assume we have a device that is performing NAT. It has one public interface (19.20.21.22) and two private interfaces (172.16.0.1 and 172.17.0.1).
Assume the following DNAT rules exist on this device:
Destination IP
Destination Port
Translated IP
Translated Port
19.20.21.22
10022
172.16.15.14
14389
19.20.21.22
10080
172.16.100.80
4389
19.20.21.22
14389
172.16.17.18
22
19.20.21.22
20022
172.17.0.22
14389
19.20.21.22
20080
172.17.200.80
80
Assume that communication has just been initiated and the following incoming packet has just arrived (through the public interface):
Header
Header
Header
Data
S: 01:02:03:AB:CD:EF D: AB:CD:EF:01:02:03
S: 129.82.103.19 D: 19.20.21.22
Seq: 15 S: 22
This is the packet’s data
https://colostate.instructure.com/courses/62572/quizzes/101669/take
10/12
4/15/2018 Quiz: Test3 – Canvas – CSU
Question 13 2 pts
Assume the same NAT device, DNAT rules, and incoming packet as in the question immediately above.
Which of the following is the service that this packet is sent to?
22
80
4389
14389 172.16.17.18
Which of the following is the address of the machine that this packet is sent to?
172.16.15.14 172.16.100.80 172.16.17.18 172.17.0.22 172.17.200.80
D: 14389
Question 14 2 pts
Assume we have a device that is performing NAT. It has one public interface (19.20.21.22) and two private interfaces (172.16.0.1 and 172.17.0.1).
Assume that communication has just been initiated and the following incoming packet has just arrived (through the private interface):
https://colostate.instructure.com/courses/62572/quizzes/101669/take
11/12
4/15/2018 Quiz: Test3 – Canvas – CSU
Header
Header
Header
Data
S: 03:04:05:AB:CD:EF D: EF:CD:AB:01:02:03
S: 172.16.17.18 D: 129.82.103.19
Seq: 15 S: 80 D: 80
Which of the following would be valid source and destination IP and port information in the packet as it leaves the NAT device?
S: 172.16.17.18, S: 80, D: 129.82.103.19, D: 80
S: 19.20.21.22, S: 10080, D: 129.82.103.19, D: 80 S: 129.82.103.19, S: 80, D: 172.16.17.18, D: 80
S: 172.16.17.18, S: 10080, D: 129.82.103.19, D: 80 S: 19.20.21.22, S: 10080, D: 172.16.17.18, D: 80
This is the packet’s data
Not saved Submit Quiz
https://colostate.instructure.com/courses/62572/quizzes/101669/take
12/12