Archive for May 2012

Raindrops on Roses, these are a few of my favorite things   Leave a comment

I do a lot of script writing for my customers. Some customers want scripts to automate daily tasks. Some customers want scripts for weird, why the heck would they want that purposes. Some want scripts that do things I would not have dreamed of doing, but they want to pay me for it, so I’m happy to help.

I have a few ‘donnisms’ that are unique to me, and some are standards from Microsoft and others. Rather than explain why I do what I do to multiple peoples, I am writing a single source for things I do in my scripts. This isn’t everything, just the majority of things and will change as I do.

  • I like the Windows PowerShell SDK page (http://msdn.microsoft.com/en-us/library/ms714469.aspx)
  • My verbs in script (and global function) names are usually selected from the list of standard verbs (http://msdn.microsoft.com/en-us/library/ms714428.aspx)
  • When I am writing a script for purpose of dot-sourcing, I preface the name of the file when I save it with ‘ds_’ (ds_Get-Something.ps1) so when I’m looking in my directory of scripts, I know that this one should be dot-sourced when I run it. After I get enough dot-sourced scripts that do common tasks, I’ll put them into a Module. This is an easy way of finding all my dot-sourced files.
  • When I get enough ds_ files that have a common theme, I create a PSM1 file that combines all my functions into a module.
  • Script (and global function) names should be PascalCased
  • Apply camelCasing to variable names
  • Provide descriptive variable names to clearly identify their purpose
  • Noun names should be specific
  • Avoid Hungarian notation in scripts (http://en.wikipedia.org/wiki/Hungarian_notation)

Posted 2012-05-21 by DonnPoSh in Donnisms, PowerShell