01 / MODEL A WINDOWS FLEET · LESSON 01

Meet the simulated Windows fleet

Collect typed OS details from the reachable computers in a clearly labelled simulation.

12 min · learn at your pace

The same language, a different collector

In this course you build tools that cross all three IT roles. The browser runs real PowerShell, while LabFleet.psm1 supplies fictional computers. Import it explicitly. Its Lab names keep the teaching commands separate from real Get-CimInstance, Get-Process, and Invoke-Command.

Get-LabComputer lists five computers and their Connection states. Three are Ready; one is Offline and one returns AccessDenied. Get-LabOperatingSystem -ComputerName app01 reads that computer's supplied OS object. These functions never inspect your device or contact another computer.

Preserve useful types

BuildNumber is a version identifier stored as text in the source. This exercise asks for its numeric representation, while Caption remains text and BootUtc becomes a [datetimeoffset]. The explicit UTC offset prevents a display timezone from changing the recorded instant. Do not use the browser's real uptime as a substitute.

Select Ready computers for this introductory report. Later lessons attempt every requested computer and keep failure records. Silently omitting inaccessible computers would make an audit incomplete; here the scope is explicitly reachable inventory.

State you can inspect and reset

The module reads fleet.json until a change creates fleet-state.json. Run retains that virtual state; Check creates a fresh environment from the supplied files and your current script. Reset restores the lesson. No operation in this course stops a real process or opens a WSMan session.

Go deeper

Read the official reference.

Try an example.ps1
Import-Module '/home/user/LabFleet.psm1' -Force
Get-LabComputer
Get-LabOperatingSystem -ComputerName app01
YOUR TURN

Put it into practice.

Import LabFleet.psm1. Emit one object for each Ready computer with ComputerName, Caption, numeric Build, and BootUtc as DateTimeOffset. Preserve the OS values. Do not emit the module or display-format records.

See an explained solution
One way to solve it.ps1
Import-Module '/home/user/LabFleet.psm1' -Force
Get-LabComputer | Where-Object Connection -EQ Ready | ForEach-Object {
    $os = Get-LabOperatingSystem -ComputerName $_.ComputerName
    [pscustomobject]@{ ComputerName=$_.ComputerName; Caption=$os.Caption; Build=[int]$os.BuildNumber; BootUtc=[datetimeoffset]$os.LastBootUpTime }
}

The collector selects the three reachable fixture hosts and emits typed property snapshots. It separates the source of observations from the report format.