• Hugo Kornelis (8/1/2013)


    Then, on using scripts and/or PowerShell in general.

    You push using this kind of automation as a way to prevent human error, because you eliminate the error-prone process of a human filling out a dialog and pressing buttons. However, humans working with a dialog *know* that they might make errors. They will usually try to prevent this by working carefully and checking what they do. Using a script gives a (sometimes false) sense of security. When people use a script, they expect it to work, period. But what if there is an error in the script? Or if the script fails to handle an unanticipated situation appropriately? If people just fire off the script and expect it to work, it can take a long time, and a lot of executions, before someone finds out. And by then, reparing the damage may be impossible.

    We really need to treat scripting like programming in general. We want to test the script using as wide a net as possible, using a variety of input, even some input that is downright bogus. Yes, this does mean generating or procuring test data and putting effort into evaluating what conditions this script will execute in. This does mean that scripting (or programming in general) will take more effort than running one instance of the steps manually.

    The advantage of scripting is that you can invest significantly more time into developing the script than would be involved in doing the steps manually, because once the script is working, you can then recoup the costs of developing the script over the subsequent executions that replace the manual steps. Every run of manual steps might include the possiblity of error, and a properly running script will eliminate this factor.

    I think we forget how errors creep into our manual work, because when we repetitively run manual operations, we start to take these operations for granted, sure, like you say we're diligent the first run through the manual steps because we anticipate that we can make errors, but how diligent do we remain after the 50th time running manual steps? The advantage to scripting is that we also should be diligent and watchful for errors during the time developing the script, but once the script is successful, that diligence against errors should be in the script now as tests for erroneous conditions and does not "age" or "decrease" as would repetitive execution of manual steps.

    And the advantage of scripting is that you can test that script to whatever extent you like, with the additional benefit that you can introduce edge cases (and downright bogus conditions) into your testing and see if you've covered conditions your script will subsequently encounter, but with manual processes, well I'm not so sure.