I have been working to learn/use more Powershell at work and as with any new language/technology the learning process has been fraught with strange gotchas and mysteries. For example, my friend had trouble with Powershell stopping processing because he was clicking wrong!
My most recent learning adventure was that the contents of certain system
directories may not be what they appear! I was goofing around with learning how
to install Powershell modules into the global location (making the module
accessible to all users). The typical advice you get on this matter is simply
to drop your module into
you will be able to
Import-Module to your hearts content.
This worked great for me until I tried to load my module with the x86 build of PowerShell. The module could not be found.
Here is the file listing for the global module location from Windows Explorer.
And here is the file listing for the global module location as seen by the x64 PowerShell.
And here is the file listing for the global module location as seen by the x86 PowerShell.
Same file location, different contents. WAT?
After much poking around I finally figured out that when you are running the
x86 build of Powershell, the contents of
C:\Windows\System32\WindowsPowerShell\v1.0\Modules are actually the contents of
Unbeknownst to me at the time, the developers of PowerShell were actually trying to help me out with this decision. Basically, the remapping of the file system allows you to always use the same pathing without worrying about which version of PowerShell you are running BUT allowing the system to segregate modules that will only work in x64 environments. The tricky bit is that for module authors that want their modules to be available to all versions of PowerShell then they must install the module in both locations. Unfortunately, this behaviour does not seem to be well documented (or my Google-fu needs work).
Good luck with your modules!