Bird
0
0

Given a module file MyModule.psm1 with a function Get-Info that returns 'Info Loaded', what will be the output of this script?

medium📝 Command Output Q4 of 15
PowerShell - Modules and Script Organization
Given a module file MyModule.psm1 with a function Get-Info that returns 'Info Loaded', what will be the output of this script?
Import-Module .\MyModule.psm1
Get-Info
AGet-Info : The term 'Get-Info' is not recognized
BInfo Loaded
CImport-Module : Cannot find path
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Understand Import-Module usage with relative path

    Import-Module .\MyModule.psm1 loads the module from current directory.
  2. Step 2: Calling Get-Info after import

    After import, Get-Info function is available and returns 'Info Loaded'.
  3. Final Answer:

    Info Loaded -> Option B
  4. Quick Check:

    Function output after import = Info Loaded [OK]
Quick Trick: Import module first, then call its functions [OK]
Common Mistakes:
  • Not importing module before calling function
  • Wrong module path causing import error
  • Expecting no output without calling function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes