سؤال

I'm trying to edit the hosts file while my program is started as "NT AUTHORITY\SYSTEM" with psexec, and I still get UnauthorizedAccessException. I thought that SYSTEM should be able to edit hosts file that's why I'm started my program with psexec -i -d -s myapp.exe. So what should I do to be able to edit hosts file?

هل كانت مفيدة؟

المحلول

Make sure that your hosts file is not marked as read-only. If it is, you will get this exception regardless of current user permissions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top