How do I check programatically if 'File and Printer sharing' is enabled for a specific network adapter ?
I guess this is what you are looking for -
Get-NetAdapterBinding | ? {$_.DisplayName -eq 'File and Printer Sharing for Microsoft Networks' -and $_.Name -eq 'ethernet'}
Name DisplayName ComponentID Enabled
---- ----------- ----------- -------
Ethernet File and Printer Sharing for Microsoft Networks ms_server True