Activate and disable the DNS-cache with a bat-file

Forums General General Discussion Windows Security Activate and disable the DNS-cache with a bat-file

Viewing 0 reply threads
  • Author
    Posts
    • #44765
      hackerman1
      Moderator

        Hi !

        I´m using a HOSTS-file from http://winhelp2002.mvps.org/hosts.htm
        Following their recommendations i have disabled the DNS-cache in order to prevent DNS-cache poisoning.

        A few days ago when i was checking some settings in “Services” i noticed that the DNS-cache was enabled !?
        I tried to disable it, which was denied because: “other services depends on it”.
        I found out that it was a process from CyberGhost VPN which i installed two months ago that needed the DNS-cache running.

        Mystery solved.
        But, I don´t want to have the DNS-cache active, except when needed by CyberGhost, so how do I solve that ?

        Here is the solution: 2 bat-files, the first starts the CyberGhost-service & the DNS-cache,
        the second stops them.

        Start CyberGhost.bat

        SC START Dnscache
        SC START CGVPNCliService
        START "CYBERGOST" "E:PROGRAM FILESCyberGhost 5CyberGhost.lnk"

        Note: the 2nd line is to the service that CyberGhost uses.
        the 3rd line is a shortcut to the “main” program (GUI) of CyberGhost,
        so of course you will have to modify those 2 lines if you are using some other VPN-program,
        by changing the service & path to the program you are using.

        Stop CyberGhost.bat

        SC STOP CGVPNCliService
        SC STOP Dnscache

        And you need to run those 2 bat-files elevated (as ADMIN).
        If you set the CGVPNCliService to start automatically then you can run the start-file without elevation.
        But if you have used the stop-file and then wants to run the start-file again,
        then it needs elevation because CGVPNCliService needs ADMIN-privileges.

        Put the bat-files in in your program-folder, create 2 shortcuts on your desktop.
        Then on both shortcuts under Properties → Advanced, mark “Run as Administrator”.

    Viewing 0 reply threads
    • You must be logged in to reply to this topic.