0
0
PowerShellscripting~30 mins

Windows features management in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
Windows Features Management with PowerShell
📖 Scenario: You are managing a Windows server and need to check which Windows features are installed, decide which features to install or remove, and then apply those changes using PowerShell scripts.
🎯 Goal: Build a PowerShell script that lists installed Windows features, sets a feature to install or remove based on a configuration, applies the change, and then shows the updated feature status.
📋 What You'll Learn
Use PowerShell commands to list Windows features
Create a variable to hold the feature name to manage
Use conditional logic to install or remove the feature
Display the final status of the feature
💡 Why This Matters
🌍 Real World
System administrators often need to automate the management of Windows features to keep servers optimized and secure.
💼 Career
Knowing how to script Windows feature management is valuable for IT support, system administration, and automation roles.
Progress0 / 4 steps
1
List Installed Windows Features
Write a PowerShell command to get all Windows features and store them in a variable called features.
PowerShell
Need a hint?

Use the Get-WindowsFeature cmdlet to list all features.

2
Set Feature to Manage
Create a variable called featureName and set it to the string 'Telnet-Client' to specify the feature you want to manage.
PowerShell
Need a hint?

Assign the feature name as a string to the variable featureName.

3
Install or Remove the Feature
Write an if statement that checks if the feature named featureName is installed by looking in $features. If it is installed, remove it using Remove-WindowsFeature. If it is not installed, install it using Install-WindowsFeature.
PowerShell
Need a hint?

Use Where-Object to find the feature by name and check its Installed property.

4
Display Updated Feature Status
Run Get-WindowsFeature again for the feature named featureName and print its name and installation status using Write-Output.
PowerShell
Need a hint?

Use Get-WindowsFeature -Name $featureName and Write-Output to show the feature status.