Resilient Scripting is scripting that can be rerun... safely
Making a script that is resilient can mean many different things to different people, IMHO an important one is to be able to re-run a script "safely". By safely I mean to minimize side effects and to prevent negative consequences. To illustrate let's say we have an install process and we need to log details about what happens when we run the install. To keep this simple let's just focus on the logging requirement. We want a log file that we can look at when an install happens. So a simple approach would be as follows. Set-Content log.txt "Information about Install" Nice and simple, we have satisfied the requirement. But let's see if we can make this one liner more resilient. $logFileTime = Get-Date yyMMddhhmmss $logFileName = $logFileTime + "_log.txt" Set-Content $logFileName "Information About Install" Now even if we run this install multiple times we will have a script for each instance of the install even when ...