Unable to update host file error - have tried all solutions in forum, UAC prompt for cmd failing?

If you are encountering the Cannot Edit Hosts File error and do not receive a prompt asking to allow “Windows Command Processor” to make changes to your device such as in the following image, before the error happens, here is a solution to try.
Command

Check If Powershell PATH Variable Exists For User & Add It If Not

  1. Press the windows key or click the start button and type env, then click “Edit the system environmental variables” or manually locate it in the Advanced System Settings.

  2. In the window that pops up, click “Environmental Variables”
    2-EnvironmentalVariables

  3. Select the PATH variable so it is highlighted, then click “Edit”

  4. In the window that pops up, check the list of variables for "C:\WINDOWS\System32\WindowsPowerShell\v1.0" or "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0"
    EditPath

  5. If you do not have "C:\WINDOWS\System32\WindowsPowerShell\v1.0" in the path variables, click “New”. If you don’t have it but do have "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0", you may still try this part to see if it solves the issue.
    NewPath

  6. Write or paste "C:\WINDOWS\System32\WindowsPowerShell\v1.0" into the text box, the click okay on all the open windows. Restart your computer and then see if Local successfully edits the host file.
    WritePath

Note: The above process checks and adds the path variable for the listed user. If another user account tries to use local they may still have the issue. They can either also add the path, or it can be added to the path variable in the “System Variables” section. Admin privileges are required to add to the system path variable.

2 Likes