This tutorial will show you how to turn on or off file and printer sharing on your Windows 11 PC.
File and printer sharing is the ability of a computer running Windows to share a folder or attached printer with other computers on the same network.
- File sharing allows you to make files and folders in a shared folder accessible to others on the same network to view, copy, or modify.
- Printer sharing allows you to make an attached printer available to other computer users on the same network.
You must be signed in as an administrator to turn on or off file and printer sharing.
Contents
- Option One: Turn On or Off File and Printer Sharing in Settings
- Option Two: Turn On or Off File and Printer Sharing in PowerShell
1 Open Settings (Win+I).
2 Click/tap on Network & internet on the left side, and click/tap on Advanced network settings on the right side. (see screenshot below)
3 Click/tap on Advanced sharing settings on the right side. (see screenshot below)
4 Click/tap on Private networks and/or Public networks to expand open. (see screenshot below step 5)
5 Turn On or Off File and printer sharing for what you want for private and public networks.
File and printer sharing is turned off by default for public networks.
File and printer sharing is turned on by default for private networks.
6 You can now close Settings if you like.
1 Open Windows Terminal (Admin), and select Windows PowerShell.
2 Do step 3 (on) or step 4 (off) below for what you want.
3. Turn On File And Printer Sharing
A) Copy and paste the command below you want to use into the elevated PowerShell, press Enter, and go to step 5 below.
(Apply to all network profiles)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Any' | Set-NetFirewallRule -Enabled 'True'OR
(Apply to "Domain" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Domain' | Set-NetFirewallRule -Enabled 'True'OR
(Apply to "Private" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Private' | Set-NetFirewallRule -Enabled 'True'OR
(Apply to "Public" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Public' | Set-NetFirewallRule -Enabled 'True' 4. Turn Off File And Printer Sharing
A) Copy and paste the command below into the elevated PowerShell, press Enter, and go to step 5 below. (see screenshot below)
(Apply to all network profiles)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Any' | Set-NetFirewallRule -Enabled 'False'OR
(Apply to "Domain" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Domain' | Set-NetFirewallRule -Enabled 'False'OR
(Apply to "Private" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Private' | Set-NetFirewallRule -Enabled 'False'OR
(Apply to "Public" network profile)
Get-NetFirewallRule -Group '*-28502*' | Where-Object 'Profile' -Match 'Public' | Set-NetFirewallRule -Enabled 'False'5 You can now close the elevated PowerShell if you like.
That's it,
Shawn Brink
Related Tutorials
- Share Printer over Network in Windows 11
- Find Printer Share Name in Windows 11
- Add Shared Printer in Windows 11
- See Computers on Network in Windows 11
- Change Network Location to Private, Public, or Domain in Windows 11
- Turn On or Off Network Discovery in Windows 11
- Turn On or Off Public Folder Sharing in Windows 11
- Change Encryption Level for File Sharing Connections in Windows 11
- Turn On or Off Password Protected Sharing in Windows 11
Last edited:











