IT Questions and Answers :)

Monday, December 30, 2019

If you are running a loop (While, For, or Foreach) in PowerShell and you want to stop the current iteration and move on to the next one, what statement do you issue?

If you are running a loop (While, For, or Foreach) in PowerShell and you want to stop the current iteration and move on to the next one, what statement do you issue?

  • Next-Item
  • Break
  • Return
  • Continue 

 If you are running a loop (While, For, or Foreach) in PowerShell and you want to stop the current iteration and move on to the next one, what statement do you issue?

EXPLANATION

Understanding the Continue statement

One of the things that is a bit confusing for beginner scripters (and even for some intermediate scripters) is the Continue statement. This is partially because it does not act like it might in some other scripting languages.
Note  Windows PowerShell is not VBScript. Windows PowerShell is not VBScript. Say this 100 times…
So, what does the Continue statement do in Windows PowerShell? It returns flow to the top of the innermost loop that is controlled by a While, For, or Foreach statement. Probably the best way to understand this is to see it in action.
Note  To read more about looping, see these Hey, Scripting Guy! Blog posts.
The following script displays the numbers 1 through 6 as the script works its way through the array.
[array]$a = 1..6
foreach ($i in $a)
{
 $i
}

Share:

What is the following command doing? MOVE "C:\users\user1\desktop\folder\file.txt" "C:\users\user1\desktop\folder\file.xtx"

What is the following command doing? MOVE "C:\users\user1\desktop\folder\file.txt" "C:\users\user1\desktop\folder\file.xtx"

  • It is changing the file's location
  • It is changing the file's type
  • It is modifying the folder the file is in
  • It is changing the file's name 
What is the following command doing? MOVE "C:\users\user1\desktop\folder\file.txt" "C:\users\user1\desktop\folder\file.xtx"
 

EXPLANATION

 In the Windows command line and MS-DOS, you can move files using the move command. For example, if you want to move a file named "stats. doc" to the "c:\statistics" folder, you would type the following command, then press the Enter key.

C:\Users\Randy> MOVE "C:\users\randy\desktop\folder\file.txt" "C:\users\randy\desktop\folder\file.xtx"
The system cannot find the file specified.

C:\Users\Randy>move "C:\Users\Randy\Desktop\folder\file.txt.txt" "C:\Users\Randy\Desktop\folder\file.txt.xtxt"
        1 file(s) moved.
Share:

What will the following command do? # tar -xvf public_html.tar

What will the following command do? # tar -xvf public_html.tar

  • Create a new public_html.tar archive using the files in the current directory
  • Untar or extract public_html.tar to the current directory
  • Untar or extract public_html.tar to /home/public_html
  • Untar or extract public_html.tar to /root 

EXPLANATION

Extracting an Archive using the Linux tar command
tar -xzvf archiveToExtract.tar.gz
This will extract all files in the archive in the current directory, the only flag that is changed is the -c (for creating) with the
x – extract the archive

 

Share:

Which of the following commands will help identify a broken router between the local and the remote machine?

Which of the following commands will help identify a broken router between the local and the remote machine?

  • netstat
  • traceroute
  • ifconfig
  • nslookup 
Which of the following commands will help identify a broken router between the local and the remote machine?

EXPLANATION

traceroute and tracert are computer network diagnostic commands for displaying the route and measuring transit delays of packets across an Internet Protocol network.

Traceroute, also called tracepath or tracert, is a network tool used to determine the path packets take from one IP address to another.
 

 


Share:

What is the maximum recommended length for a POE cable for 802.3af and 802.3at from Point A to Point B?

What is the maximum recommended length for a POE cable for 802.3af and 802.3at from Point A to Point B?

  • 85m
  • 50m
  • 70m
  • 100m 

EXPLANATION

Ethernet and POE both restrict cable distances to 100 metres (328 feet) between network ports. However, POE-powered devices such as IP cameras and wireless access points frequently must be located at far greater distances from the nearest network switch or power outlet.

For passive POE you should use a 24V power supply. 24V passive POE will power an OM series AP up to about 50 meters or 100-150 feet. 802.3af and 802.3at PoE standards have a distance limit of 100 meters or 328ft which is also the limit for the data transmission for Ethernet cables

Share:

Popular Posts