Often I find that the last thing I want to look at is yet another new language to learn, but PowerShell is proving itself to be very useful for writing up Windows scripts, particularly when you want to interact directly w
ith Microsoft services. In my project I have several web applications set up in IIS, and my version control structure has the trunk and an arbitrary number of branches. Whenever I would want to switch to working on a different branch of the code, I would need to reset the IIS applications to point to the new path; this quickly became more tedious than I like.
This seems like a good example to show what a very simple PowerShell script can do. I’m not going to cover how to set up PowerShell, but I will say that if you are on Windows 7, it’s already there waiting for you. For this example, you also need to make sure you have the IIS PowerShell module set up.