This is actually pretty easy if you’re going to deploy modules in Windows Module but it is CRITICAL to FOLLOW THE RULES. I know some people either a) don’t follow them and are rebelling against Society as a whole or b) honestly don’t know them. I’ll opt for b) because By and Large most Developers and Product Teams are pretty decent people.
No exceptions or an Angry Gru will reach down from within Microsoft and force you to write “I will not do this” 1000 times in pure Binary using only an Abacus, a box of broken crayons (melted) on wet toilet paper. Or perhaps I will cast a D20 to determine if a Yeti goes free. Or a massive release of Tribbles. We will look at this in BIG Bold Letters so NOBODY forgets
DO NOT PUT ANY MODULES IN “%SYSTEMROOT%system32WindowsPowerShellv1.0Modules”
This area is verboten. It belongs to Windows O/S only. If you put things here there is a GOOD chance it will get wiped out some time or possibly you will hear a big booming voice echoing throughout the skies. Or Sean The Energized Tech might write a horrible song about you doing it.
Ok …. just don’t do it. This will avoid a certain Tribble/Yeti invasion bursting forth.
Just make your own folder under Maybe %ProgramFiles% or possibly even under %PUBLIC% and we’ll all be a lot happier
DO update the Modules Path variable with the location of your new module. There is an environment variable called %PSModulePath% – It is JUST like %PATH% to add information to. If you add the Path to your new module to THIS variable people will be able to find it by doing GET-MODULE. So again let’s remember this in BIG BOLD LETTERS.
UPDATE %PSMODULEPATH% with the Path of your Module…. *P*L*E*A*S*E*
If you do NOT do this you will not only make life more difficult for Systems Administrators using Windows Powershell, you will also make many Many MANY Windows Powershell MVP’s VERY ANGRY (And we’re usually a pretty happy bunch)
So if you have a product and you’re creating a Windows Powershell module, please follow these two small steps to make our lives easier and your modules so that your Cmdlets can be AutoDiscovered in Powershell Version 3.
So if you have a Product with a module and you are not following this… put in a freaking hotfix or something to just do this. It makes your stuff so much easier to work with…. and lessens the chance of me writing some horrid parody music about it NOT being there.
*Nuff said* I shall jump off my Soapbox now