Level 1
0 / 100 XP

PowerShell Objects and Properties

In this lab, you will learn that PowerShell commands return objects, not plain text. You will examine the properties and methods of PowerShell objects, select specific properties, and sort and filter object data.

Session duration: 30 minutes· Typical launch: ~3 min

Difficulty

Beginner

Lab level

Lab VMs

1

1 Windows

XP Reward

150 XP

On completion

Virtual machines

Lab VMs

Windows

SADC01

Windows

Username / Password

user / password123

Connection type

In-browser RDP / RDP

CPU / RAM

Lab instructions

Follow the steps below to complete the lab.

In this task, students will learn that PowerShell commands return objects, not plain text.

  1. Login with username ladmin and password password123.
  2. Open Windows PowerShell as Administrator.
  3. Display a list of running processes:
Powershell
Get-Process
  1. Examine the properties and methods of a process object:
Powershell
Get-Process | Get-Member
  1. Display only the Name, Id, and CPU properties of each process:
Powershell
Get-Process | Select-Object Name, Id, CPU
  1. Display the Name, Status, and DisplayName properties of all services:
Powershell
Get-Service | Select-Object Name, Status, DisplayName
  1. Display the properties available for a service object:
Powershell
Get-Service | Get-Member
  1. Display the five processes using the most memory:
Powershell
Get-Process | Sort-Object WorkingSet -Descending | Select-Object -First 5 Name, WorkingSet
  1. Display only running services:
Powershell
Get-Service | Where-Object Status -eq Running
  1. Display the operating system version:
Powershell
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
  1. Let’s use the get-childitem command.
Powershell
Get-ChildItem | Select-Object Name, Length, LastWriteTime
  1. Export the running services to a CSV file in the Downloads folder:
Powershell
Get-Service | Select-Object Name, Status | Export-Csv "$env:USERPROFILE\Downloads\ServicesProperties.csv" -NoTypeInformation
  1. Click Check step to proceed.