Organizing Powershell Scripts

We have dived deeply into powershell scripting for many of our daily it operational tasks. The scripts talk to a lot of platforms i.e. systems center, Solarwinds, exchange etc. At the moment whenever we create a script we schedule a task in task manager to have it executed automatically.

Our NOC team is starting work on an intelligent alert management system, which is primarily a VBNet application but most of the underlying logic wrt collecting, filtering and reporting alerts will be implemented in PS scripts. Again they would either be running as a scheduled task (every 1 minute) or they would be executed once but with a never ending loop.

Is there a better way to manage the scripts and bits of code running through task manager. I am seeing that the number of scripts will keep on increasing as we move along. And soon we would need a better way to manage these scripts.

What would be your criteria for better management? Like, what business concerns are you looking at address?

Hi Don,

Thank you for your reply.

  1. Central location for all scripts.
  2. Easy backup and recovery of the scripts.
  3. In case the server fails, ability to easily recover and execute the scripts from another server.
  4. Control access for executing, editing etc scripts
  5. Execute scripts on specific times of the day, week etc.
  6. Monitoring of scripts and generating alerts if some script failed to execute or stopped in between etc

I think you get the idea.

  1. Would be a private Nuget repo. Don’t create scripts; create script modules, which you can package and offer through the repo. Find-Module and Install-Module become your deployment tools.

  2. Would be backing up said repo.

  3. Nuget repo’s are web based, so just set up a redundant server.

  4. You’d usually source-control scripts in terms of controlling access to editing. E.g., Git or whatever.

  5. Task Scheduler. Or, if you have another orchestration tool, that.

  6. This is where you’d need an orchestration tool, a la System Center SMA or something.