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


previous-buttonnext-button

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

  1. Pingback: Don’t do that #10 : Use Exception.Message in Catch - Powershell Guru

  2. Pingback: Don’t do that #12 : Use several lines to get the parent container path of an AD user object - Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *