Introduction
Importing modules lets you use extra commands and features that are not built into PowerShell by default.
Import-Module -Name ModuleName
Import-Module -Name Microsoft.PowerShell.Management
Import-Module -Name Az
Import-Module -Name Pester
Import-Module -Name Microsoft.PowerShell.Utility Get-Command -Module Microsoft.PowerShell.Utility
Import-Module command do in PowerShell?MyTools in PowerShell?Import-Module ModuleName without extra parameters.Import-Module Microsoft.PowerShell.Utility Get-Command -Module Microsoft.PowerShell.Utility | Select-Object -First 1 -ExpandProperty Name
Import-Module MyModule but get an error: ModuleNotFoundException. What is the most likely cause?-not (Get-Module -Name MyModule) checks if module is missing, then imports it.Import-Module MyModule -Force forces import regardless. Piping Get-Module output to Import-Module is invalid syntax. -SkipIfLoaded is not a valid parameter.Pass the test and this pattern moves unknown