Don’t do that #11: Reload a module with Remove-Module and Import-Module

By | April 10, 2015

Don’t do that: The following code remove and import a module in order to get the latest changes of a module.

Indeed, when creating a module, we could need to reload the module into the current session to work with the latest changes (useful during development).

Remove-Module -Name module
Import-Module -Name .\module.psd1

Do that: It’s easier to reload the module with the –Force parameter:

Import-Module -Name .\module.psd1 -Force


Leave a Reply

Your email address will not be published.