Search code examples
c#powershellwmi

File and Printer Sharing Status


How do I check programatically if 'File and Printer sharing' is enabled for a specific network adapter ? enter image description here


Solution

  • 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