Editing hosts file using cmd

Hey Guys,

I started working with a new organization and they had very strict policies when it comes to system Security.
Only 'cmd' or 'powershell' can be executed with elevated rights.

My problem: I need to modify my hosts file which requires admin privileges.

Start Powershell with elevated rights and type below Commands:

PS C:\> $newProc = new-object System.Diagnostics.ProcessStartInfo "notepad"        
PS C:\> $newProc.Arguments = "notepad.exe"                                                              
PS C:\> $newProc.Verb = "runas"                                                                                   
PS C:\> [System.Diagnostics.Process]::Start($newProc)                                                

Now, You can see Notepad is running in administrator mode. Perform your Changes and save it.

You can start any exe using above process(unless your exe is not blocked by your locla IT).

Happy Coding!!


Popular posts from this blog

GIT Error : Filename too long warning: Clone succeeded, but checkout failed. You can inspect what was checked out with 'git status'

What is CMS? Why we need it?