In Windows Vista it might at a first glance appear to be tricky to automatically enable File and Printer sharing and Network discovery. However it is actually very easy when you know what to type. The “netsh” command comes in handy here, and you can use the below strings in a script to enable it on many clients automatically.
To enable File and Printer sharing you run the command:
netsh firewall set service type=fileandprint mode=enable profile=all
To enable Network discovery you run the command:
netsh advfirewall firewall set rule group=”network discovery” new enable=yes
Please note that you can change which profile you want to apply the changes for.
EDIT: First and foremost, I accidently added the “profile=all” to the Network Discovery string which is totally incorrect, as Network discovery is enabled for all profiles when this command is run. Second, if you are using Windows in another language than English you will have to adjust “network discovery” to what it is called in your localized language. For instance on the Swedish version of Vista it would be:
netsh advfirewall firewall set rule group=”nätverksidentifiering” new enable=yes
EDIT 2: The network discovery script only work with Windows Vista with Service Pack 1.