PowerShell Genie
Practice Identify script-based modules

Identify script-based modules

Exercise 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Return available modules whose ModuleType is Script.

The task

A script behaves differently on two hosts. Start by recording the installed module type and version.

Target

Return available modules whose ModuleType is Script.

What the result tells you

ListAvailable lists discoverable modules, not only modules imported into the current session. Compare versions and paths when hosts behave differently.

Verify the result

Run the source by itself and inspect the sample objects. Add each filter separately, then check the final properties and order.

The browser uses a small fictional dataset. Real results depend on the host, module, account and target environment.

What does ListAvailable tell you?

Choose an answer, then check your reasoning.

Worked solution

Worked solution

Reveal one approach
1PS> Get-Module -ListAvailable | Where-Object ModuleType -eq 'Script' | Select-Object Name, Version

Related reference

Read the command and platform requirements
Next exercise

Try it in the lab

Write your pipeline below and run it against the fictional sample data, then check your result against the expected answer.

Interactive simulation · fictional data
Genie guideIdentify script-based modules

Return available modules whose ModuleType is Script.