RousselTMLEARNING

TP · Windows administration: from discovery to expertise

Lab: Inventory a server with PowerShell

What you will learn in this TP
  • Discover cmdlets with Get-Command and Get-Member
  • Filter, sort and export objects
  • Write a parameterized script and run it remotely

Introduction #

What you will learn in this section
  • Discover cmdlets with Get-Command and Get-Member
  • Filter, sort and export objects
  • Write a parameterized script and run it remotely

Context. Your manager asks for a server status report before a migration. Rather than clicking through each console, you write a reusable inventory script.

Prerequisites: a disposable Windows Server 2025 virtual machine (free evaluation) with an administrator account, and PowerShell open as administrator  ·  Estimated duration: 45 min

An Inventaire.ps1 script, a CSV report and an HTML page.

Setup #

Guided steps, with their solution.

  1. 1. Prepare the workspace

    Why? A dedicated folder avoids mixing scripts and reports.

    Create C:\TP\Scripts and C:\TP\Rapports, check the PowerShell version and allow local scripts.
  2. 2. Explore the system

    Why? Get-Member reveals available properties before selecting them.

    Display the server’s name, version, build, total memory and last boot.
  3. 3. Disks and services

    Why? The two most frequent incident causes: full disk and stopped service.

    List volumes with their free percentage, then automatic services that are not running.
  4. 4. Write the script

    Why? A parameterized script can be reused and run remotely.

    Write C:\TP\Scripts\Inventaire.ps1 returning one object per server (system, RAM, free C disk, number of stopped automatic services, latest update).
  5. 5. Produce the reports

    Why? CSV opens in a spreadsheet, HTML can be shared.

    Export the result as timestamped CSV and HTML in C:\TP\Rapports.
  6. 6. Run remotely

    Why? Invoke-Command queries several servers in parallel.

    Run the script on the local server and a second machine (or localhost twice if you only have one), then gather the results.

Difficulty level : ●○○○○ (1/5)

My progress

  • ⏱ Estimated time : ≈ 45 min

Sign in to track your progress and take notes. Sign in

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Users, groups, NTFS permissions and SMB shares

Manage local accounts and groups, understand UAC, apply NTFS permissions with inheritance, create...

Group Policy (GPO): configuring the estate from Active Directory

Design and troubleshoot Group Policy: computer and user configuration, OU linking, LSDOU order, i...

Ansible: the inventory (static, dynamic, groups and variables)

Understand and master the Ansible inventory: INI and YAML files, groups, host and group variables...

Linux administration best practices

Checklist for administering Linux servers: accounts and sudo, SSH, updates, systemd services, sto...

Linux server security and hardening

Harden a Linux server: least privilege, updates, secure SSH, firewall, fail2ban, SELinux and AppA...

Processes, memory and performance: monitoring and troubleshooting a Linux server

Understand and control Linux processes (ps, top, signals, nice, jobs), interpret load, memory and...

Backup, monitoring and troubleshooting of a Linux server

Operate a Linux server day to day: 3-2-1 backup strategy with rsync, tar, LVM snapshots and resti...

Linux system architecture: kernel, boot and directory tree

Understand how a Linux server works: kernel and user space, the UEFI, GRUB, initramfs and systemd...

Storage on Linux: disks, partitions, file systems and LVM

Administer Linux storage: lsblk and blkid, GPT partitioning, ext4 and XFS, mounting and /etc/fsta...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!