I believe that the best place to do that is in visual Studio, not in task scheduler. I could tell you how to do it with task scheduler, but it would be a real hack.
There are two ways to do it with Visual Studio. One is to use Visual Studio to create a "makefile" to do your build, then edit the make file and add "shutdown.exe" with appropriate options as the last step. Then run the makefile when ever you want to build and shut down.
The other option is to use visual studio to add a "custom build step" to your build. You will specify shutdown.exe as the program to run in the custom step and you will define where in the build that it should run (last step) and under what conditions it should run; perhaps unconditionally, perhaps only if the build was successful.
Which method you choose is entirely up to you. VS advocates make the case that VS build gives you much more flexibility than makefiles.