It is common to hear the phrase – PowerShell looks out for you, when anyone talks about how PowerShell is friendly. What they really mean is that PowerShell has several functionalities that help you not mess up. This is achieved by using methods such as the ShouldProcess method, or, in other words, the WhatIf parameter. Also, in cases where what you are going to do with the function is drastic, you could also add a Confirm parameter to it.
Supporting both of these functionalities can be tricky sometimes. In this recipe, you will add a WhatIf switch to the file creation process so that the user knows what would happen if they ran the cmdlet, and add a Confirm switch to ask the user whether they would really like to create the files.