文件和打印机共享状态
File and Printer Sharing Status
如何以编程方式检查是否为特定网络适配器启用了 'File and Printer sharing'?
我想这就是您要找的 -
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
如果您使用 Windows 10,则可以使用 Get-NetAdapter
列出您的适配器。一旦你找到合适的 "toto" 你可以使用 :
Get-NetAdapter "toto" | Set-NetAdapterBinding –ComponentID ms_server –Enabled $False
如何以编程方式检查是否为特定网络适配器启用了 'File and Printer sharing'?
我想这就是您要找的 -
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
如果您使用 Windows 10,则可以使用 Get-NetAdapter
列出您的适配器。一旦你找到合适的 "toto" 你可以使用 :
Get-NetAdapter "toto" | Set-NetAdapterBinding –ComponentID ms_server –Enabled $False