As I said above I believe that Powershell will have this type of functionality - but do not have the actual experience with it to guide you further.
There may be other members here, of course, who do have this knowledge.
Other than this possibility I can only suggest you check out Microsoft themselves or one of the many tutorials.
There are many
As this illustrates ....
powershell tutorials - Google Search