Jay Bazuzi
Jay Bazuzi

Reputation: 46496

Where do you store your library of PowerShell scripts?

As soon as you start using PowerShell, you are likely to start collecting small, useful scripts. Managing them well is tricky.

Upvotes: 8

Views: 2823

Answers (4)

user60229
user60229

Reputation:

I keep my powershell profile & custom scripts in a mercurial repository. I frequently switch between my development machine at home and the development environment at work so using a distributed VCS really has its advantages: Each machine is self-contained (no need to access a source-control-server at work from home through a VPN that does not exist in my case).

I pull/push changes from the local repo on each machine to a "transfer" repo on USB stick and things still work out correctly.

Upvotes: 1

Keith Hill
Keith Hill

Reputation:

+1 for source control. Our project's powershell scripts usually wind up in one of:

  • $/project/Trunk/Build
  • $/project/Trunk/Tests/Bin
  • $/project/Trunk/Tools/Bin

For personal scripts, at the moment I use two approaches. First I create a ~\Bin, put that in the path and put my personal PowerShell scripts there. The second approach is that I use Live Mesh to sync a PowerShell folder between all my machines. It has scripts, presentations, etc in it.s I should probably create a Bin subdir in the mesh folder and put that bin dir in my path.

V2 introduces Module support, so any modules I create would go under ~\Documents\WindowsPowerShell\Modules.

Regarding the question about using scripts from others and versioning, read up on Modules and Module Manifests in V2. I think this new feature will help.

Upvotes: 1

JaredPar
JaredPar

Reputation: 754585

I put everything into source code control including my ever expanding powershell library. This the primary way I version and spread the scripts amongst machines.

Upvotes: 0

David
David

Reputation: 34543

We treat PowerShell scripts just like other code. They are stored in TFS just like everything else. This handles storage, backups, versioning, and merging. Our standard build & deployment process handles moving these scripts between servers.

Upvotes: 2

Related Questions