0
0
PowerShellscripting~20 mins

Module manifest (.psd1) in PowerShell - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell Module Manifest Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of a basic module manifest property
Given this snippet from a PowerShell module manifest (.psd1), what is the output of the command $manifest.Author after importing the manifest as a variable?
PowerShell
@{RootModule = 'MyModule.psm1'; Author = 'Jane Doe'; ModuleVersion = '1.0.0'}
A'Jane Doe'
B'MyModule.psm1'
C'1.0.0'
Dnull
Attempts:
2 left
💡 Hint
Look for the key named 'Author' in the hashtable.
📝 Syntax
intermediate
2:00remaining
Correct syntax for specifying RequiredModules in a .psd1
Which option correctly specifies the RequiredModules key in a PowerShell module manifest to require two modules named 'PSReadLine' and 'Pester' with minimum versions 2.0 and 5.0 respectively?
A@{RequiredModules = @{'PSReadLine'='2.0'; 'Pester'='5.0'}}
B@{RequiredModules = @('PSReadLine', 'Pester')}
C@{RequiredModules = @('PSReadLine:2.0', 'Pester:5.0')}
D@{RequiredModules = @(@{ModuleName='PSReadLine'; ModuleVersion='2.0'}, @{ModuleName='Pester'; ModuleVersion='5.0'})}
Attempts:
2 left
💡 Hint
RequiredModules expects an array of hashtables with ModuleName and ModuleVersion keys.
🔧 Debug
advanced
2:00remaining
Identify the error in this module manifest snippet
This snippet is part of a PowerShell module manifest (.psd1). What error will occur when PowerShell tries to import this manifest?
PowerShell
@{
  RootModule = 'MyModule.psm1'
  Author = 'John Smith'
  ModuleVersion = '1.0.0'
  FunctionsToExport = @('Get-Data', 'Set-Data'
}
ASyntaxError due to missing closing parenthesis in FunctionsToExport array
BRuntime error because RootModule file does not exist
CNo error, manifest imports successfully
DTypeError because FunctionsToExport must be a string, not an array
Attempts:
2 left
💡 Hint
Check the brackets and commas in the FunctionsToExport line.
🚀 Application
advanced
1:30remaining
Determine the number of exported commands from a manifest
Given this module manifest snippet, how many commands will be exported by default when the module is imported?
PowerShell
@{
  RootModule = 'MyModule.psm1'
  FunctionsToExport = @('Get-Item', 'Set-Item')
  CmdletsToExport = @('Invoke-Action')
  AliasesToExport = @()
}
A1
B2
C3
D0
Attempts:
2 left
💡 Hint
Count all functions, cmdlets, and aliases listed for export.
🧠 Conceptual
expert
1:30remaining
Understanding the role of PrivateData in a module manifest
What is the primary purpose of the PrivateData key in a PowerShell module manifest (.psd1)?
ATo list all private functions that should not be exported
BTo store custom data used internally by the module or tools, not processed by PowerShell itself
CTo specify the private variables accessible only within the module
DTo define the private dependencies that are not installed automatically
Attempts:
2 left
💡 Hint
Think about data that is not standard manifest keys but useful for module authors or tools.