Enabling Network Discovery and File and Printer sharing on Windows Server
WARNING : This does not work Windows Server Core
Some folk have been arriving to this post hoping to find a solution for Windows Server Core might need to look elsewhere. I've only tested this on Windows Server 2012.
Service requirements
We need to make sure the following services are running
# Check status of services required for Network Discovery on Windows
Get-Service -DisplayName "Function Discovery Resource Publication"
Get-Service -DisplayName "DNS Client"
Get-Service -DisplayName "SSDP Discovery"
Get-Service -DisplayName "UPnP Device Host"
If not any are not running, start them
# Start required services
Get-Service -DisplayName "Function Discovery Resource Publication" | Start-Service
Get-Service -DisplayName "DNS Client" | Start-Service
Get-Service -DisplayName "SSDP Discovery" | Start-Service
Get-Service -DisplayName "UPnP Device Host" | Start-Service
Firewall requirements
Check whether respective firewall rules are both set to Allow and also Enabled
Get-NetFirewallRule -DisplayGroup "Network Discovery" | ft
Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" | ft
If not, allow and enable them
# Set action to allow
Get-NetFirewallRule -DisplayGroup "Network Discovery" | Set-NetFirewallRule -Action Allow
# Enabling the rule
Get-NetFirewallRule -DisplayGroup "Network Discovery" | Enable-NetFirewallRule
# Set action to allow
Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" | Set-NetFirewallRule -Action Allow
# Enabling the rule
Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" | Enable-NetFirewallRule