By Joe Brinkman on
10/17/2007 6:36 AM
In my last post
Getting a Username/Password in PowerShell (cross posted to
PowerShellCommunity.org), I was asked why not just use the Add-Member cmdlet. Having been doing software development for my entire adult life, this is not the first time this question has come up. Ok. Maybe not those exact words, but something very similar - why use code X when code Y does the same thing. Where I come from there is really only one response to this - look at both code alternatives and determine which one is the most efficient at doing the job without also becoming a maintenance problem. So lets take a peek under the hood a bit so we can see why I chose PSObject.Members.Add over using the Add-Member cmdlet.
Scripting is code - except on the command line
When working in PowerShell I try to keep a clear...