> > I have moments with PS where I'm stunned how much I get done and how fast. > Other days, I want to poke my eyes out with a sharp stick after trying to > do something that seemed trivial. >
I can see that for sure! That seems to be the double-edged sword of all scripting languages. I have a small lesson here that might interest some people. I used this exercise in updating MSI tables as a practically useful excuse to write some reasonably serious PS script and get familiar with the tricks and traps. That worked I think, as I can sort of think the PS way better now and I see where it's useful. I expect to adopt it rapidly now to replace countless BAT files I have lying around. After about 6 total hours of coding practice I finished up with 80 lines of PS script that were almost working. Most of the time was spent searching for the best PS way of doing something (splitting strings for example), or for finding the correct syntax for arrays, or casts and so on. I was almost there when I found I couldn't open the MSI file in update mode, which I expect would have taken hours of more research to solve. There was no explanation for this at all, and the error output was worthless. At this point I had a brain-fart and went over to LINQPad. Using C#'s dynamic keyword and some familiar interop calls I had the complete MSI update process working perfectly in 15 minutes in a fraction of the amount of PS code. So I guess .. it's about using the right language for the right job. *GK*