-Create a script named network.ps1 that meets the requirements listed below: Pro
ID: 3646389 • Letter: #
Question
-Create a script named network.ps1 that meets the requirements listed below:Protocols loop
-Create an array called protocols that contains the following items:
Ethernet
ATM
Frame-Relay
-Use a foreach loop to print out each item in the array
-Subnets loop
Create an array that contains the following subnets:
10.200.150.0
10.200.143.0
10.200.152.0
-Use a foreach to print out a message that state "The computer with the subnet is located in room XXX" where XXXis the 3rd octet in the subnet. (Hint use the split() function)
-Create a for loop that prints the numbers from 1 to 256
-Create a for loop that prints the IP addresses from 10.200.150.1 to 10.200.150.254
-Creating user accounts: Create a for loop that creates user with the username of studentID1 - studentID10 with a password of Password1 (where studentID is your student username)
Explanation / Answer
1. creating a protocols array
$myArray = @("Ethernet","ATM","Frame-Relay")
2.using foreach loop
foreach ($element in $myArray) {write-host $element}
3. $myArray1 = @("10.200.150.0 ","10.200.143.0 ","10.200.152.0 ")
4.foreach($ele in $myArray1)
{
$line-split=$ele.split(".")
write-host "the computer with the subnet is located in room" $line-split[2]
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.