I have a problem with a Hyper-V internal network adapter and my external network (Intel Wi-Fi). Sometimes after starting a VM I lose access to my network shares both from my LAN and from VM itself (I get connection timeout, like port is closed). The firewall is configured manually with
gpedit.msc to allow TCP/UDP trafic from both LAN and VM subnets (I can reach
postgres fine from both LAN and VM).
I found a workaround, by disabling and re-enabling this
File and Printer Sharing for Microsoft Networks it seems to work (I need to do it on both adapters to restore connectivity for LAN and VM respectively).
Question: Is there any PowerShell/WMI/VBScript command to automate this? I found
Set-NetAdapter but it doesn't seem to have any relevant options.