I was wondering if I could get some clarification about something. I have a bat file that calls a powershell script using the ExecutionPolicy of bypass. Anyhow, in my script I’m doing a import-module on PSExcel.psd1. As a developer, I like to clean up after myself once I’m finished with my processing. I know when you use Import-Module that module is available only during that session so I’m assuming calling Import-module for each call to my script is okay. However, I’m wondering if I should do a remove-module at the end of my script just as a good practice. Any input on this? Should I not worry about calling remove-module or should I?
No need at all. Even if you import the same module over and over, all you’ll get is a warning saying it was already done, and PowerShell manages its scopes quite well.
Thanks Don. That’s what I thought.