Bird
0
0

You want to create a PowerShell module that contains both script functions and compiled cmdlets. Which approach should you use?

hard📝 Application Q8 of 15
PowerShell - Modules and Script Organization
You want to create a PowerShell module that contains both script functions and compiled cmdlets. Which approach should you use?
ACreate a script module (.psm1) and import the binary module inside it.
BCreate a binary module (.dll) that calls script functions internally.
CCombine script and binary code in a single .psm1 file.
DCreate two separate modules and never import them together.
Step-by-Step Solution
Solution:
  1. Step 1: Understand module composition

    Script modules can import binary modules to combine functionality.
  2. Step 2: Use script module as wrapper

    Create a .psm1 script module that imports the binary module to expose both types of commands.
  3. Final Answer:

    Create a script module (.psm1) and import the binary module inside it. -> Option A
  4. Quick Check:

    Combine script and binary modules via import = B [OK]
Quick Trick: Use script module to wrap and import binary modules. [OK]
Common Mistakes:
  • Trying to mix code in one file
  • Not importing binary modules inside script modules
  • Avoiding combined usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes