logo
SlackReddit

Import Module

Import the module

Note: You don't need to do this manual import step if you installed the module using the install-module method.

In order make the Invoke-AtomicTest function available for use in your current PowerShell session you must import the module. This is done automatically for you in the PowerShell window where you installed the execution framework, but in the event that you start a new PowerShell window, you will need to re-import the module which can be done as follows.

Windows

Import-Module "C:\AtomicRedTeam\invoke-atomicredteam\Invoke-AtomicRedTeam.psd1" -Force

Linux

Import-Module "$HOME/AtomicRedTeam/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force

MacOS

Import-Module "$HOME/AtomicRedTeam/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force

Note: If you installed AtomicRedTeam to a different path, you would need to adjust this command accordingly.

You can verify that the module is installed using Get-Module.

Add the Import to your PowerShell Profile

If you would like to ensure that the Invoke-AtomicTest functionality is always available, without having to manually import the module first, you can add the import statement to your PowerShell profile. See the Microsoft documentation for how to use PowerShell profiles.

A simple way to access your profile script is to execute the following from a PowerShell prompt.

Windows

notepad $profile

Linux

nano $profile

MacOS

open -a TextEdit $profile

Here is an example profile to import the module at startup and to set the default -PathToAtomicsFolder.

Windows

Import-Module "C:\AtomicRedTeam\invoke-atomicredteam\Invoke-AtomicRedTeam.psd1" -Force
$PSDefaultParameterValues = @{"Invoke-AtomicTest:PathToAtomicsFolder" = "C:\AtomicRedTeam\atomics"}

Linux

Import-Module "$HOME/AtomicRedTeam/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force
$PSDefaultParameterValues = @{"Invoke-AtomicTest:PathToAtomicsFolder" = "$HOME/AtomicRedTeam/atomics"}

MacOS

Import-Module "$HOME/AtomicRedTeam/invoke-atomicredteam/Invoke-AtomicRedTeam.psd1" -Force
$PSDefaultParameterValues = @{"Invoke-AtomicTest:PathToAtomicsFolder" = "$HOME/AtomicRedTeam/atomics"}

Once you have edited and saved the profile in notepad, you can either restart PowerShell to have the profile take effect or execute the following command.

. $profile