Build a Windows Server Inventory Tool with PowerShell
In this lab, you'll practice building a comprehensive server inventory tool using PowerShell. You'll have a script to inventory a Windows server when you finish.
Terms and conditions apply.
Lab info
Lab author
Challenge
Getting Started in the Lab Environment
Here are the initial instructions and explanation of the lab environment. Read this while your environment is busy creating itself from nothing. Yes, this violates physics; we know. How fun!
Challenge
Understand CIM and How to Interact with It
This lab is going to focus heavily on WMI or CIM. WMI (Microsoft’s version of CIM) is a management framework that exposes thousands of informational attributes about a Windows system. This challenge will encourage you to explore CIM and see what you can do with it. In this short, introductory challenge, you will learn which PowerShell cmdlets can query information about a Windows system from CIM. You’ll learn some CIM basics by observing the output PowerShell returns, and catch a few tips to discover new ways to explore a Windows system.
Challenge
Query Disk Space
The tool you’ll build in this lab will have many different functions. This challenge will kick off the real work of building a server inventory tool and use PowerShell to discover disk space information. You will use the Get-CimInstance cmdlet to query CIM on the local Windows system.
Challenge
Retrieve RAM and CPU Details
In this challenge, you'll dive into querying crucial hardware information from a Windows system. You'll learn how to use PowerShell to retrieve details about the total memory, CPU type, and CPU speed. This knowledge is vital in understanding your system's capabilities and performance.
Challenge
Query Operating System Information
In this short challenge, you'll explore how to query vital operating system information from a Windows system. You'll learn how to use PowerShell and WMI to retrieve key details such as the OS version, service pack level, architecture, and last boot time.
Challenge
Query Windows Services
In this challenge, you will delve into querying Windows services using PowerShell. You'll eventually learn how to retrieve details such as the status, start type, and display name of services to add them to your server inventory report.
Challenge
Build the Tool Script
As of now, you have done all of the hard work. You’ve discovered all the commands to query the information you're after. You’ve saved the rough commands into a script, but the script is far from done. In this challenge, it’s time to refactor the script so it can all run as a single unit, can return the reporting output you’re after, and will be scalable.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.
Recommended prerequisites
- Basic familiarity with PowerShell
- Beginner to intermediate experience with Windows Server
- Familiarity with editing in Visual Studio Code, and navigating the Windows file system