1. #1
    hackerman1 is offline Moderator
    Join Date
    Dec 2008
    Location
    Sweden
    Posts
    1,525

    Default Activate and disable the DNS cache with a bat file

    Hi !

    Im using a HOSTS-file from Blocking Unwanted Connections with a Hosts File

    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 dont 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

    Code:
    SC START Dnscache
    SC START CGVPNCliService
    START "CYBERGOST" "E:\PROGRAM FILES\CyberGhost 5\CyberGhost.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

    Code:
    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".
    Last edited by hackerman1; 15th February 2014 at 14:46.

  2. #2
    HappyAndyK's Avatar
    HappyAndyK is offline Site Administrator
    Join Date
    Jun 2008
    Posts
    7,318

    Default

    Hey, that's a nice tip. Thanks for posting!

  3. #3
    hackerman1 is offline Moderator
    Join Date
    Dec 2008
    Location
    Sweden
    Posts
    1,525

    Default

    You are welcome.
    btw. i also posted a warning about VPN-clients...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22