Why you should not add you PowerShell modules to Windows directory

In his presentations Getting Started with PowerShell 3.0 Jump Start & Advanced Tools & Scripting with PowerShell 3.0 Jump Start , Jason Helmick stresses that you should never put you PowerShell module in Windows directory (usually c:\windows\system32\WindowsPowerShell\…) but he doesn’t give a good explanation why you should not do that. I though that it may be useful for some people to understand why it is not such a good idea to do it.

First of all, You do not “own” that directory, Microsoft does. System updates, patches, hotfixes, they all may go and modify Windows directory, removing your files. Microsoft may decide to move that folder to some other place and it will not be a breaking change.

It’s usually not backed up. The obvious places to be backed up are user folders, especially user Documents. Windows folder is not. That means you can loose your modules when data needs to be restored from back.

It may be wiped out during OS upgrade. There is no guarantee that data in Windows folder will be preserved when upgrading Operating System. You may loose your modules.

It is a bad practice to go and mess up somebody’s else space. The Windows folder belongs to Microsoft, the Pester’s module folder belongs to Pester module and the RabbitMQTools module folder belongs to RabbitMQTools project. Unless you are contributing to any of those project you should not add anything there.

So, follow Jason’s advice and DO put your modules in PowerShell subfolder in user’s documents, not in Windows folder.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s