PowerShell Hands-On Exercises Primer 2
The capabilities of PowerShell extend well beyond basic scripting. In this lab, you'll journey through some of its advanced features. You'll move into real-world system administration tasks by integrating other languages like .NET to enhance data security, and will look at proactive system monitoring, safeguarding data through backups, and efficient file and network management.
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
Encoding and Decoding Sensitive String Data using .NET Components in PowerShell
To start this lab, you will examine the process in three fundamental stages. Firstly, you will import a .NET library into the PowerShell environment. Then, you will construct two functions devoted to encoding and decoding string values. Finally, you will secure the two functions further by adding a required key. By the end of this challenge, you'll be able to create functions using .NET components for encoding and decoding string values.
Challenge
Implement a Script to Monitor Disk Space on all Computer Partitions
In this challenge, you will gather data on the existing partitions of a computer. Following this, you will extract crucial storage metrics, concentrating on the available versus utilized space. Lastly, you will develop a script that regularly monitors these metrics, empowering you to act when storage reaches critical levels.
Challenge
Automate the Backup Process of Specific Directories
Automating backup data security and integrity. You will begin by identifying critical data directories, and will then automate the backup process using PowerShell. By the end of this challenge, you'll have a hands-off, systematic backup process ensuring your data remains intact and retrievable.
Challenge
Monitoring and Logging CPU Usage
You will start with extracting real-time CPU usage metrics and using PowerShell's logging capabilities to record these metrics over time. Wrapping up the challenge, you will institute alerts and notifications for scenarios where CPU usage breaches predefined thresholds. Once done, you'll have a PowerShell script for CPU performance monitoring.
Challenge
Manage and Report on Windows Scheduled Tasks
You will now list all existing scheduled tasks and extract key attributes. You will then work with PowerShell to manipulate these tasks, such as starting, stopping, or modifying them. Finally, you will create a report detailing the status of these tasks. By the end of the challenge, you will be able to query and report on Windows automation tasks.
Challenge
Search for Files Within the Folder Based on Passed Keywords
In this challenge, you examine a directory's content and familiarize yourself with its structure. As you progress, you'll develop a PowerShell script capable of parsing the content based on provided keywords. You will then optimize the search function to return results quickly and accurately. At the end of this challenge, you'll know how to search and find what you need when you need it.
Challenge
Retrieve and Display the Top 10 Largest Files
Further file management can be done by enumerating all files within a specified directory, and cataloging them based on size. You will do this, and will then filter this list to identify the top 10 largest files. To wrap up, you'll display the output, making the information user-friendly. By the end of this challenge, you'll know how to identify large files within any given directory.
Challenge
Use PowerShell to Ping a List of Computers
To finish up the lab, you will read a list of computers or IPs from an external file. You'll then integrate the classic ping command within a PowerShell script, measuring the online status of each entry. You'll then compile and display these results in an organized, easy-to-read format. By the end of the challenge, you'll be able to check the connectivity of many devices, streamlining network management.
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
- Windows Server 2022. Similar, for this lab, to Windows Client (Windows 10/11)
- PowerShell 5.0 or later
- Visual Studio Code
- PowerShell Extension for VS Code
- Administrative privileges