Cannot enable Network Discovery via PowerShell

Reed Kimble 1 Reputation point
2022-06-16T14:10:56.87+00:00

I'm aware of the answers that just say to enable the related firewall settings, but this is not enough. You still have to manually go into the GUI in the advanced options and check the radio button to enable network discovery, otherwise the machine cannot browse the network and does not appear to other machines. Here are the various PowerShell routines I'm using, all of which work successfully in their own right, but are just not enough.

Starts the 'Function Discovery Resource Publication' and 'Function Discovery Provider Host' services necessary for network resource browsing and sets their start mode to Automatic:

$Svc1 = Get-Service -DisplayName 'Function Discovery Resource Publication'   
$Svc2 = Get-Service -DisplayName 'Function Discovery Provider Host'  
Set-Service -InputObject $Svc1.Name -StartupType Automatic -Status Running  
Set-Service -InputObject $Svc2.Name -StartupType Automatic -Status Running  

Enables the various network discovery firewall settings for the Domain profile:

netsh advfirewall firewall set rule name=”network discovery (wsd-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (wsd eventssecure-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (wsd events-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (upnp-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (ssdp-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (pub-wsd-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (nb-name-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (nb-datagram-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (llmnr-udp-in)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (llmnr-udp-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (wsd-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (wsd eventssecure-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (wsd events-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (upnp-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (upnphost-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (ssdp-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (pub wsd-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (nb-name-out)” profile=domain new enable=yes  
netsh advfirewall firewall set rule name=”network discovery (nb-datagram-out)” profile=domain new enable=yes  

Enables File and Printer Sharing in the Domain Profile of Windows Firewall:

netsh advfirewall firewall set rule name="file and printer sharing (echo request - icmpv4-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (echo request - icmpv6-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (llmnr-udp-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-datagram-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-name-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-session-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (smb-in)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (spooler service - rpc)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (spooler service - rpc-epmap)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (echo request - icmpv4-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (echo request - icmpv6-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (llmnr-udp-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-datagram-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-name-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (nb-session-out)" profile=domain new enable=yes  
netsh advfirewall firewall set rule name="file and printer sharing (smb-out)" profile=domain new enable=yes  

I am intentionally only enabling these firewall rules on the Domain profile. The other profile rules do not seem to matter as long as the computer is active in the domain profile. Even after manually changing the radio button to enable network discovery, the firewall rules do not change so I do not believe the other profiles have any impact.

Does anyone know what else can be done via PowerShell to actually make that radio button change state?

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,379 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,602 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.