PowerShell Basic Lab

Objective:

Complete the commands to obtain the results given.

Deliverables:

Take a screenshot for every command returning results as intended.


Part 1: Networking

Get an IPv4 Address from Ethernet Interface.

This command says, "Filter the results returned from Get-NetIPAddress Where-Obeject is like Ethernet.

Unsolved:

Solved:

chevron-rightCommand Explanationhashtag

Get-NetIPAddress -AddressFamily IPv4

  • Gets all network IP addresses on the system

  • filters to only IPv4 addresses

Where-Object {$_.InterfaceAlias -ilike "Ethernet"}

  • Filters the results to only network interfaces whose name contains "Ethernet."

  • The -ilike operator does a case-insensitive pattern match.

  • $_ represents each network adapter being evaluated

.IPAddress

  • Extracts just the IP address property from the matching network interface object

Get IPv4 PrefixLength from Ethernet Interface

Unsolved:

Solved:

chevron-rightCommand Explanationhashtag

Show what classes there is of Win32 library that starts with net and sort alphabetically.

Unsolved:

Solved:

Get DHCP Server IP Address and hide the table headers

Unsolved:

Solved:

Get DNS Server IPs for Ethernet interface and only display the first one

Unsolved:

Solved:

Part 2: Directory Listing

circle-exclamation
circle-check

List all the files in your working directory

Unsolved:

Solved:

Create a folder called "outfolder"

Unsolved:

Solved:

List all the files in your working directory that has the extension ".ps1" and save the results to out.csv file in "outfolder" directory

Unsolved:

Solved:

Without changing the directory, find every .csv file and change their extensions to .log. Then recursively display all the files

Unsolved

Solved

Last updated