0
0
PowerShellscripting~15 mins

Module manifest (.psd1) in PowerShell - Mini Project: Build & Apply

Choose your learning style9 modes available
Create a PowerShell Module Manifest (.psd1)
📖 Scenario: You are packaging a PowerShell module to share with your team. To do this properly, you need to create a module manifest file (.psd1) that describes your module's metadata and settings.
🎯 Goal: Build a simple PowerShell module manifest file (.psd1) with essential information like module name, version, author, and description.
📋 What You'll Learn
Create a hashtable named ModuleManifest with specific keys and values
Add a ModuleVersion key with a version string
Include author and description information
Output the manifest content as a formatted string
💡 Why This Matters
🌍 Real World
Module manifests are used to describe PowerShell modules so others can understand and use them properly.
💼 Career
Knowing how to create and manage module manifests is essential for PowerShell developers and system administrators who package and share reusable scripts.
Progress0 / 4 steps
1
Create the basic module manifest hashtable
Create a hashtable called ModuleManifest with these exact keys and values: ModuleName set to 'MyModule', Author set to 'Jane Doe', and Description set to 'This is a sample PowerShell module.'
PowerShell
Need a hint?

Use @{} to create a hashtable and assign keys with =.

2
Add the module version to the manifest
Add a key ModuleVersion with the value '1.0.0' to the existing ModuleManifest hashtable.
PowerShell
Need a hint?

Add the new key and value inside the hashtable using the same syntax as before.

3
Convert the manifest hashtable to a formatted string
Use ConvertTo-Json and Out-String to convert the ModuleManifest hashtable into a JSON formatted string and store it in a variable called ManifestString.
PowerShell
Need a hint?

Use the pipeline | to send ModuleManifest to ConvertTo-Json and then to Out-String.

4
Display the module manifest content
Print the content of the ManifestString variable to the console using Write-Output.
PowerShell
Need a hint?

Use Write-Output followed by the variable name to print the string.