Make directory creation idempotent
Description of changes:
Add -Force param to new dir creation to allow future runs to be error-free.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Just to make sure I am clear on this one, the -Force is where the Idempotency comes in? Should a If statement or something added to Check? Should this be put in a Custom Script Block in DSC? Look forward to hearing your feedback and thoughts.
Yep, the -Force ignores the error if the directory already exists and doesn't mess with anything previously created. e.g. if you create a dir and even add items to it, re-running New-Item ... -Force leaves things intact.
Perhaps not the best named flag! ;-)
IMHO, I don't think you need an if statement since the New-Item cmdlet already has this built-in mechanism. I also don't think you need it in the custom script block either for the same reason.
HTH!
Cool Thanks I am testing this and the other PR, it failed so I need to determine cause. I will throw up errors in bit.