Opening up Windows Firewall for File and Printer Sharing

By default, Windows Firewall’s setting for File and Printer Sharing is set to “subnet” scope: only allow requests from the same subnet as itself. This is generally a good default security policy that balances safety with convenience, but on my home network, I run several different subnets (wired, wireless, VPN, etc.) and this tends to be an issue.

Here’s a very simple VB script that can be run with Windows Scripting Host to expand the scope from “subnet” to “any”:

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

Set colServices = objPolicy.Services
Set objService = colServices.Item(0)
objService.Enabled = TRUE
objService.Scope = 0

I stick that in a file named winfw-smb-scope-any.vbs and run it from a DOS prompt with cscript.exe. Done!

Do you have any other handy scripts you think are really useful? Tell me about them in the comments … thanks!

Tags: , , ,

Comments

  1. I’ve been experiencing problem. My wife and I are on a home network. My computer is directly connected to the router; I have her computer set up to receive a wireless connection. The printer is also connected to my computer directly.

    As it is now, I can share my printer with her via the network, so she can print as long as my computer is on. However, I have to choose to share it again every time my computer is turned or restarted.

    I’m going to give this solution a try. Thanks!

  2. Mike: The “File and Printer Sharing” not being preserved across restarts sounds like a different problem, to me – but, you can always try and see if changing the Windows Firewall scope helps.

    Let us know how it turns out!

  3. Dossy: I was originally having problems getting it to work at all because my anti-virus firewall setting was set too high. Should be interesting to try at least. I’ll let you know how it goes.

Speak Your Mind

*