Windows 10 Script to disable Network Discovery

#1
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
 


ussnorway

Windows Forum Team
Staff member
Premium Supporter
#2
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
Just try this but it won't work :( got another idea ?
Thanks
 


#4
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
 


ussnorway

Windows Forum Team
Staff member
Premium Supporter
#5
Just try this but it won't work
Works ok at my end
Screenshot (271).png

Screenshot (272).png


error message "no rule corresponding to specified criteria"
= 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
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 ?
 


ussnorway

Windows Forum Team
Staff member
Premium Supporter
#7
ok, & please post a screenshot of the cmd command/ error message you get, like mine above... that would help.
 


#8
I'll also try on my personal computer windows 10 home and got same issue maybe it's because i've got french version
 


Attachments

#9
This is firewall
 


Attachments

#10
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
netsh advfirewall firewall set rule group="Recherche du réseau" new enable=no
 


ussnorway

Windows Forum Team
Staff member
Premium Supporter
#12
Gratz mate.
 


#13
It works when I run cmd as admin but it won't work with a .bat or .exe :(
 


#14
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
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
 


AceInfinity

Senior Member
Microsoft MVP
#16
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
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.
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.