A blog with focus on experiences with the Windows Client operating systems…
RSS icon Email icon Home icon

  • Script for enabling Network discovery and File and Printer sharing in Vista

    Posted on February 14th, 2008 By Andreas Stenhall + 6 comments

    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.

     

    6 responses to “Script for enabling Network discovery and File and Printer sharing in Vista”

    1. I tried these commands and while the first one was successful, I ran into a little snag with the second. I dont have the exact message but it said basically I cant assign profile when using group. Have you tried this 2nd command for network discovery and been able to apply it to all profiles? Thank you.

    2. Andreas Stenhall

      I have updated the post to reflect the changes of me mistakingly adding the “profile=all” to the string of commands. When you remove that part Network Discovery will be enabled by default on all profiles.

    3. When I run the second command I get the error:

      “Group cannot be specified along with other identification conditions.”

      I Googled it but could not find any assistance.

      Any suggestions?

    4. Andreas Stenhall

      The Network Discovery command only work with Vista with Service Pack 1. Post updated!

    5. Check the difference in the quotations you will see it is using a differet ” i changed mine and it worked perfectly.
      netsh advfirewall firewall set rule group=”network discovery” new enable=yes

    6. It seems to change the quote to a different mark on this page when i posted, so you will have to edit it yourself

    Leave a reply

    You must be logged in to post a comment.