Powershell: Import a module from a file

Hi,

you just want to test a module and don’t want to install or copy it to the Powershell Modules directories? It’s possible 🙂

For example the SpeculationControl module to query the speculation control (Spectre/Meltdown vulnerability) settings of your system.

Download the latest version from the powershell gallery.

Got to the manual download tab and get the nuget package. The nuget package is a zip which contains the module and some metainformations (dependencies….).

Extract the SpeculationControl.psm1 and SpeculationControl.psd1 files to a folder, i.e. D:\temp.

Load the modules. Fileextension can be omitted is not necessary

PS D:\> Import-Module -Name  D:\temp\SpeculationControl

Check if Get-SpeculationControlSettings is available

PS D:\> get-help *spec*

Name                              Category  Module                    Synopsis
----                              --------  ------                    --------
Get-SpeculationControlSettings    Function  SpeculationControl        This function queries the speculatio

Thats it

PS D:\> Get-SpeculationControlSettings
For more information about the output below, please refer to https://support.micr

Speculation control settings for CVE-2017-5715 [branch target injection]

Hardware support for branch target injection mitigation is present: True
Windows OS support for branch target injection mitigation is present: True
...

Michael

Leave a Reply