Reputation: 155
I'm having a weird issue using a network location to autoload a custom PowerShell module I wrote for my department. I added the path to the network folder in the registry on my desktop and laptop and both exhibit the same issue. I saved the module to that folder, and now every single time I launch PowerShell, whether ISE or the console, the "Preparing modules for first use" message displays, but never goes away:
Oddly enough, I'm still able to use the functions in the module with no issues, and the message goes away after I run a command, but until then it just stays there. I have left it alone for hours to see if it would ever go away, but it never does until I run something. For me it's not a big deal, but I'm going to share this module with my team and it may cause confusion for them, plus it's just kind of annoying so I'd like to figure out why the message sticks. Anyone ever see this?
Upvotes: 3
Views: 5045
Reputation: 155
So after some testing, I've discovered, for whatever reason, this behavior happens when you add a UNC network path to the PSModulePath registry key to permanently add the path to the $env:PSModulePath variable. I changed the path in the registry key to a mapped drive path, with a drive letter, to the same network location, and I don't get the annoying lingering message. It appears PowerShell just doesn't like module paths preceded by "\".
Upvotes: 4