Today I regret that I have Vista on my laptop that I use for one pet project. Because of the User Account Control (UAC), I cannot run some automated build tasks. Namely tasks to manage virtual directories under IIS7.

When I try to execute the CreateVirtualDirectory and DeleteVirtualDirectory tasks from SDC Tasks Library, I get an "Access is denied" error. It happens, because such operations require the administrative privileges, but by default the UAC forces users (even from the administrators group) to run like they were regular users without such privileges.

There is only one way to run automated builds that touch system components — disable UAC. It is possible to do either through the user interface or from the command line.

You should be warned disabling UAC you reduce the security level of the system and also it will require reboot to apply the changes. Though there are some alternatives, but they require manual steps.

  1. Right clicking on a build script file, select the "Run as administrator" command.
    Drawback: the script will be started in the System32 directory and you will have to either specify full paths to other files or specify them in the PATH environment variable.
    (Update: there is a way to keep the current directory of a batch-file being run as administrator).
  2. Instead of running a build script as administrator, run a command prompt with evaluated privileges, change the location to one with your build scripts and start them from there.
  3. Run build scripts as a user from the administrators group using the Runas command.
    Drawback: UAC will prompt you for administrative privileges and you will also have to provide a password. Runas does not accept empty passwords.

For now I decided to go with the second solution and do some build's steps manually.