Where do you keep the PowerShell script library?

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

  • Where do you keep your PowerShell scripts?
  • How do you track versions and make backups?
  • How do you synchronize between machines?
  • How do you integrate new versions of other scripts? (Including dealing with violation of changes between their scenarios and yours).
  • Do you see how PowerShell V2 changes the image?
+6
scripting powershell
source share
4 answers

We look at PowerShell scripts, like other codes. They are stored in TFS, like everything else. It handles storage, backup, versioning and merging. Our standard build and deployment process allows you to move these scripts between servers.

+2
source share

+1 for source control. Our project scenario scripts usually end in one of:

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

For personal scenarios, I am currently using two approaches. First I create ~ \ Bin, put this in the path and set my personal PowerShell scripts. The second approach is that I use Live Mesh to synchronize the PowerShell folder between all my machines. It has scripts, presentations, etc. I should probably create a subdirection of Bin in the mesh folder and put this bin directory in its path.

V2 introduces module support, so any modules I create will be under ~ \ Documents \ WindowsPowerShell \ Modules.

Regarding the question of using scripts from others and versions, read the modules and Modular manifests in V2. I think this new feature will help.

+1
source share

I save my powershell profile and user scripts in the mercurial repository. I often switch between my home development machine and the development environment at work, so using distributed VCS really has its advantages: each machine is autonomous (there is no need to access the source server when working from home through a VPN, which does not exist in my case) .

I pull / push the changes from the local repo on each machine to β€œtransfer” the repo to the USB drive, and everything still works correctly.

+1
source share

I put everything in the source code, including my expanding powershell library. This is the main way that I use version and distribution of scripts among machines.

0
source share

All Articles