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

4168995-dt-content-rid 27617625. 1/courses/W.CIS 161HDLMM.001MOT-MG F18HW2.pdf A

ID: 3744973 • Letter: 4

Question

4168995-dt-content-rid 27617625. 1/courses/W.CIS 161HDLMM.001MOT-MG F18HW2.pdf Automatic Zoom Script 2.2: The string object in PowerShiell has many useful methods for working with text strings. In this problem, you will use the substring method to parse and IP address into individual octets. The substring method extracts a substring from a string and has two forms: Substring(int startindex) Substring(int startindex, int length) In the first syntax form "Substring(int startindex)". Enclosed within the parentheses is the integer parameter startindex". This parameter identifies the beginning of the substring. Exe string. In the second syntax form the parameter length specifies the length of the string to extract. Remember that the index into a string is 0-based, so the first character is at index 0 and not index 1 Refer to the Variables pageString Operators section in the ebook for examples on using sub Write a script called parse_IPv4address that is passed the string parameter Sipaddress. For the sake of simplicity, assume that each octet will always consists of three digits. The first line of the script is: param ( Sipaddress ) Approach: 1. Use the substring operator to extract the tirst octet and store it in the variable octet 2. Use the substring operator to extract the second octet and store it in the variable octet2 3. Use the substring operator to extract the third octet and store it in the variable octet3. 4. Use the substring operator to extract the fourth octet and store it in the variable octet4 5. Use the wirte-host cmdlet with a quoted string to display the output in the format shown below When executing the script always pass three-digit octets in the IP address S 12.2-parse ipv4addr.ps1 192.168.001.152 ctetl: 192 octet2: 168 octet3: 001 octet4: 152 S2.2-parse ipv4addr.ps1 ctetl: 207 octet2: 075 octet3: 134 octet4: 001 207 075 134 001 20 August 2018 2-5

Explanation / Answer

here is your script : ----------->>>>>>>>>>

param($ipaddr)
$oct1 = $ipaddr.substring(0,3)
$oct2 = $ipaddr.substring(4,3)
$oct3 = $ipaddr.substring(8,3)
$oct4 = $ipaddr.substring(12,3)
write-host "octet1: $oct1 octet2: $oct2 octet3: $oct3 octet4: $oct4"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote