Question: Question#1: Write the PowerShell code necessary to prompt the user to enter a number and store that value in a variable called $userPIN using a
Question#1:
- Write the PowerShell code necessary to prompt the user to enter a number and store that value in a variable called $userPIN using a datatype of Int32. Type out a listing of your code and paste a screen shot of it running here:
- Check if the userPIN entered is positive and if not print out an error message. Type out a listing of your code and paste a screen shot of it running here:
- Check if the userPIN entered is at least 4 digits long and if not print out an error message. Type out a listing of your code and paste a screen shot of it running here:
Question#2:
- Write the Powershell code to store the following values in string datatype variables as follows:
$ip1 = 172.23.99.10
$ip2= 172.23.99.15
$ip3 = 127.0.0.1
$ip4 =172.23.99.100
Next write the PowerShell code to create an array called $ip_array that contains all of the above variables. Type out a listing of your code and paste a screen shot of it running here:
- Write the PowerShell code necessary to loop through the elements of the array from #1 and display a message that the element is Not Local host or Local Host depending whether the ip address in the element is the same as the localhost address. Type out a listing of your code and paste a screen shot of it running here:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
