You just don't have enough permission. It also depends on Windows version. On Windows 7 and later (Vista, too, but did it ever existed? :-)) with its UAC, it's not enough to be logged on as administrator, you still have to run the application under elevated privileges. Please see:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights/[
^],
http://www.sevenforums.com/tutorials/11841-run-administrator.html[
^].
You can avoid exception in all cases, if you request elevated privileges from the very beginning, when you start the application in any way. You can embed appropriate application manifest with this option. Please see:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[
^].
Note that you cannot avoid UAC dialog requesting for user confirmation, which would defeat the purpose of UAC. You can only switch off confirmation for the system globally, which I would not recommend.
See also:
http://en.wikipedia.org/wiki/User_Account_Control[
^].
—SA