0
0
PowerShellscripting~20 mins

Script modules vs binary modules in PowerShell - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PowerShell Module Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference in creation between script and binary modules
Which statement correctly describes how script modules and binary modules are created in PowerShell?
ABoth script and binary modules are created only as PowerShell scripts (.psm1).
BScript modules are created using PowerShell scripts (.psm1), while binary modules are compiled .NET assemblies (.dll).
CScript modules are compiled .NET assemblies (.dll), while binary modules are plain PowerShell scripts (.psm1).
DBinary modules are created using PowerShell scripts (.psm1), and script modules are compiled .NET assemblies (.dll).
Attempts:
2 left
💡 Hint
Think about the file extensions and how PowerShell loads code.
💻 Command Output
intermediate
2:00remaining
Output of Get-Module for script vs binary modules
Given a script module and a binary module loaded in PowerShell, what will the 'ModuleType' property show for each when running Get-Module?
PowerShell
Get-Module -Name MyScriptModule, MyBinaryModule | Select-Object Name, ModuleType
AMyScriptModule: Script; MyBinaryModule: Binary
BMyScriptModule: Binary; MyBinaryModule: Script
CMyScriptModule: Script; MyBinaryModule: Script
DMyScriptModule: Binary; MyBinaryModule: Binary
Attempts:
2 left
💡 Hint
ModuleType reflects how the module was implemented.
📝 Syntax
advanced
2:00remaining
Correct syntax to import a binary module
Which command correctly imports a binary module named 'MyBinaryModule' located in the default module path?
AImport-Module -Script MyBinaryModule
BImport-Module -Assembly MyBinaryModule.dll
CImport-Module -Name MyBinaryModule
DImport-Module -FilePath MyBinaryModule.psm1
Attempts:
2 left
💡 Hint
Import-Module uses -Name for modules in the module path regardless of type.
🔧 Debug
advanced
2:00remaining
Error when importing a binary module
You try to import a binary module with Import-Module -Name MyBinaryModule but get the error: 'Could not load file or assembly'. What is the most likely cause?
APowerShell does not support binary modules.
BThe script module file (.psm1) is corrupted.
CYou used Import-Module with the wrong parameter -Script.
DThe binary module DLL is missing or not in the module path.
Attempts:
2 left
💡 Hint
Check if the DLL file exists where PowerShell expects it.
🚀 Application
expert
3:00remaining
Choosing module type for performance and extensibility
You need to create a PowerShell module that requires high performance and access to .NET features not available in PowerShell scripts. Which module type should you choose and why?
ABinary module, because it is compiled and can use full .NET capabilities for better performance.
BScript module, because it is easier to write and runs faster than binary modules.
CScript module, because binary modules cannot access .NET features.
DBinary module, because script modules cannot be imported in PowerShell.
Attempts:
2 left
💡 Hint
Think about compiled code vs interpreted scripts.