Are you using Fast boot? If so you will have issues with this.
To answer your question directly, yes you can do this with using PowerShell and re-occurring program. You can also use CI/Baseline, etc. But if you are using Fastboot then your script will be more involved.