Can't edit hosts file in Windows Server 2012

When trying to edit the hosts file, I get a "The process cannot access the file because it is being used by another process."

I know the file is controlled by the SYSTEM.  I tried opening NotePad with administrator rights but that did not help. I am not logged in as the system, but as an administrator and have full control on the  C:\Windows\System32\drivers\etc folder.

How can I edit the hosts file?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cliff GaliherCommented:
Some other process (non-standard) has that file then. Could be antivirus. Could be something more nefarious. Grab a tool like procmon and find what's holding the file handle.
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
You need administrator privileges. Vat art command prompt as administrator and then run the following:

Notepad c:\windows\system32\drivers\etc\hosts
PBITAuthor Commented:
Already running notepad in admin mode.  That does not solve the problem.
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Luis MouraCommented:
Try in safe mode, and check if you can.
Cliff GaliherCommented:
Safe mode will likely (temporarily) solve the problem. But I'd still be concerned about why you can't edit in the first place. Again, that *isn't* normal. You'd be attacking the symptom and not the cause. If A/V is grabbing files that long for a simple scan, it'll interfere with other important processes. And if it isn't A/ probably want to know that too.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee W, MVPTechnology and Business Process AdvisorCommented:
I agree with Cliff - this is not normal behavior and could be a virus.  

Step back.  WHY do you need to adjust the hosts file?

What does the host file look like now?

Could your Antivirus be "locking" it to prevent malware from doing something it shouldn't be?
Rakesh KapoorCommented:
Open Notepad by selection the option run as an administrator > click on File > select Open and then browse the path of host file i.e. c:\windows\system32\drivers\etc\hosts.

Make the changes and then save it. Hope it would fix the issue.
PBITAuthor Commented:
Thanks, I will look into the virus scanner potential.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2012

From novice to tech pro — start learning today.