As it turns out I was misinformed and the premise of the question is erroneous.
As @mklement0 points out in the OP comments, New-PSDrive -Scope Local
(the default) does in fact create a drive in the scope of the module, which is not accessible to the module's calling scope (without using -Scope Global
).
In my case, my custom module created a PSDrive in the local scope only if it doesn't already exist, but the code immeditately before it imported a module (the ConfigurationManager
module), which created the same PSDrive in the Global
scope during its import process, so I was under the mistaken impression that my locally scoped PSDrive was somehow being made available outside of the custom module's scope.