質問

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