Windows 10 Script to disable Network Discovery

Discussion in 'Programming and Scripting' started by Davidctv, Nov 3, 2015.

  1. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    Hi,

    I would like to create a bat file that will disable Network Discovery on Windows 10.
    Any help would be greatly appreciated.

    Thanks,
    David
     
  2. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,540
    Likes Received:
    318
    Why?
    A batch file won't work but a exe (run as admin) should work...

    netsh advfirewall firewall set rule group="network discovery" new enable=no
     
  3. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    Just try this but it won't work :( got another idea ?
    Thanks
     
  4. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    error message "no rule corresponding to specified criteria" i'm french not sure of the translation, this script will be executed directly on local computer
     
  5. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,540
    Likes Received:
    318
    Works ok at my end
    Screenshot (271).
    Screenshot (272).

    = You made a typo or didn't run as admin... could also mean your system has non-default Windows build, like a beta test copy but I assume wx pro or home.
     
  6. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    I use a classic version of Windows 10 pro I just try on another computer with w7 and it won't wor too, I will search why, maybe because i use a french version ?
     
  7. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,540
    Likes Received:
    318
    ok, & please post a screenshot of the cmd command/ error message you get, like mine above... that would help.
     
  8. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    I'll also try on my personal computer windows 10 home and got same issue maybe it's because i've got french version
     

    Attached Files:

  9. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    This is firewall
     

    Attached Files:

  10. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    It works !!!! need to write in original language but i've tried with "decouverte du réseau" and the group name is "recherche du réseau" thankk you very much
     
  11. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    netsh advfirewall firewall set rule group="Recherche du réseau" new enable=no
     
  12. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,540
    Likes Received:
    318
    Gratz mate.
     
  13. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    It works when I run cmd as admin but it won't work with a .bat or .exe :(
     
  14. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    If somebody can help me to create an exe file.
    Cause my bat won't work and if I compile my .bat in .exe it wont work too.
    Just need an exe who launch
    netsh advfirewall firewall set rule group="Recherche du réseau" new enable=no

    Thanks
    David
     
  15. Davidctv

    Davidctv Member

    Joined:
    Nov 2, 2015
    Messages:
    12
    Likes Received:
    0
    Ok I found ! need to replace é by , in the bat !!
    When I'm in cmd I need to use
    netsh advfirewall firewall set rule group="Recherche du réseau" new enable=no
    but for bat file need to use
    netsh advfirewall firewall set rule group="Recherche du r,seau" new enable=no
     
  16. AceInfinity

    AceInfinity Senior Member
    Microsoft MVP

    Joined:
    Aug 12, 2011
    Messages:
    159
    Likes Received:
    11
    Hmm? Why would you think a batch file wouldn't work? All he needs to do is right click on the *.bat file and choose to Run as Administrator. This allows the batch script to run within an elevated command prompt which is no different than typing the command into an Administrator command prompt.
     

Share This Page

Loading...