Bird
0
0

Given the following PowerShell code, what will be the output?

medium📝 Command Output Q13 of 15
PowerShell - Modules and Script Organization
Given the following PowerShell code, what will be the output?
Import-Module .\MyBinaryModule.dll
Get-Command -Module MyBinaryModule
ALists all functions defined in the script module MyBinaryModule.psm1.
BThrows an error because binary modules cannot be imported.
CLists all cmdlets exported by the binary module MyBinaryModule.
DNo output because Get-Command does not work with modules.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Import-Module with a DLL

    Importing a DLL file loads a binary module containing compiled cmdlets.
  2. Step 2: Get-Command with -Module parameter

    Get-Command lists all commands exported by the specified module, here the binary module.
  3. Final Answer:

    Lists all cmdlets exported by the binary module MyBinaryModule. -> Option C
  4. Quick Check:

    Import DLL + Get-Command -Module = list cmdlets [OK]
Quick Trick: Get-Command -Module lists commands from imported modules [OK]
Common Mistakes:
  • Thinking binary modules cannot be imported
  • Confusing script and binary module outputs
  • Assuming Get-Command does not work with modules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes