Enable file and print sharing command line - how to enable it just for profile=privateHow do I configure Windows Firewall to permit MSRPC?How to configure Windows Firewall to protect the external interface but not the internal one?Slow SMB/CIFS to/from Win2008R2 ServerWhy is file sharing over internet still working, despite all firewall exceptions for filesharing being disabled?Disable “Windows Firewall with Advanced Security” for all profiles(Domain,Public,Standard) in local GP using script help! Windows 7 Clientscan I reset the windows 7 public firewall profile defaults?Windows 2K8 R2 in AD environment not allowing SMB connectionslan to wan connection refused by windows firewallWindows network shares still visible (and accessible) with “file and printer sharing” deactivatedEnabling Network Discovery via GPO does not work when Windows Firewall turned on

Does an ice chest packed full of frozen food need ice?

Logarithm of exponential

Do simulator games use a realistic trajectory to get into orbit?

Why is one of Madera Municipal's runways labelled with only "R" on both sides?

What is the highest possible temporary AC at level 1, without any help from others?

How to deal with apathetic co-worker?

Difference between > and >> when used with a named pipe

1980s live-action movie where individually-coloured nations on clouds fight

Arriving at the same result with the opposite hypotheses

What do abbreviations in movie scripts stand for?

Soft question: Examples where lack of mathematical rigour cause security breaches?

Why did the Herschel Space Telescope need helium coolant?

Is the term 'open source' a trademark?

How did old MS-DOS games utilize various graphic cards?

Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?

How to tell your grandparent to not come to fetch you with their car?

Second (easy access) account in case my bank screws up

This riddle is not to see but to solve

Generate a Graeco-Latin square

English word for "product of tinkering"

What can I, as a user, do about offensive reviews in App Store?

How can "научись" mean "take it and keep trying"?

Does Disney no longer produce hand-drawn cartoon films?

Overlapping String-Blocks



Enable file and print sharing command line - how to enable it just for profile=private


How do I configure Windows Firewall to permit MSRPC?How to configure Windows Firewall to protect the external interface but not the internal one?Slow SMB/CIFS to/from Win2008R2 ServerWhy is file sharing over internet still working, despite all firewall exceptions for filesharing being disabled?Disable “Windows Firewall with Advanced Security” for all profiles(Domain,Public,Standard) in local GP using script help! Windows 7 Clientscan I reset the windows 7 public firewall profile defaults?Windows 2K8 R2 in AD environment not allowing SMB connectionslan to wan connection refused by windows firewallWindows network shares still visible (and accessible) with “file and printer sharing” deactivatedEnabling Network Discovery via GPO does not work when Windows Firewall turned on






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








3















I know that the following cmd can enable file and print sharing firewall rule:



netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes


But it turns on file and print sharing for all profiles.



I'd like to only enable it for private profile, i.e. when the windows PC/laptops are connected to home or work network. I especially try to avoid turn it on for laptops connected to public network. Ideally Network discovery should be turned off for public network.



I've tried



netsh advfirewall firewall set rule group=”File and Printer Sharing” profile=private new enable=Yes


and 'profile' switch is rejected. So how can I apply the firewall rule selectively?



many thx for any input..










share|improve this question




























    3















    I know that the following cmd can enable file and print sharing firewall rule:



    netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes


    But it turns on file and print sharing for all profiles.



    I'd like to only enable it for private profile, i.e. when the windows PC/laptops are connected to home or work network. I especially try to avoid turn it on for laptops connected to public network. Ideally Network discovery should be turned off for public network.



    I've tried



    netsh advfirewall firewall set rule group=”File and Printer Sharing” profile=private new enable=Yes


    and 'profile' switch is rejected. So how can I apply the firewall rule selectively?



    many thx for any input..










    share|improve this question
























      3












      3








      3


      1






      I know that the following cmd can enable file and print sharing firewall rule:



      netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes


      But it turns on file and print sharing for all profiles.



      I'd like to only enable it for private profile, i.e. when the windows PC/laptops are connected to home or work network. I especially try to avoid turn it on for laptops connected to public network. Ideally Network discovery should be turned off for public network.



      I've tried



      netsh advfirewall firewall set rule group=”File and Printer Sharing” profile=private new enable=Yes


      and 'profile' switch is rejected. So how can I apply the firewall rule selectively?



      many thx for any input..










      share|improve this question














      I know that the following cmd can enable file and print sharing firewall rule:



      netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes


      But it turns on file and print sharing for all profiles.



      I'd like to only enable it for private profile, i.e. when the windows PC/laptops are connected to home or work network. I especially try to avoid turn it on for laptops connected to public network. Ideally Network discovery should be turned off for public network.



      I've tried



      netsh advfirewall firewall set rule group=”File and Printer Sharing” profile=private new enable=Yes


      and 'profile' switch is rejected. So how can I apply the firewall rule selectively?



      many thx for any input..







      windows-firewall






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 19 '13 at 11:35









      user1866880user1866880

      2595818




      2595818




















          5 Answers
          5






          active

          oldest

          votes


















          2














          You are activating a preset rule, and I am guessing that the preset rule has Profile=any in it.



          Try this first:



          netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private





          share|improve this answer

























          • Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

            – user1866880
            Jun 19 '13 at 20:31












          • oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

            – Rod MacPherson
            Jun 19 '13 at 20:53











          • File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

            – Rod MacPherson
            Jun 19 '13 at 20:53











          • File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

            – Rod MacPherson
            Jun 19 '13 at 20:54


















          4














          netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=public|private|domain new enable=Yes|No


          To set three profiles together at one time, use:



          netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes


          The rule name must be changed in your local language, for example:



          netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes


          Don't forget to run as an administrator.






          share|improve this answer
































            0














            Circling around the subject there are rare cases when using local language names doesn't work, ie. Polish Udostępnianie plików i drukarek (SMB — ruch przychodzący) = File and Printer Sharing (SMB-In). I believe this has something to do with UTF-8 handling in netsh as there are reports that using netsh for connecting to UTF-named wifi networks sometimes doesn't work too.



            In those cases use PowerShell's Set-NetFirewallRule and language-agnostic "Name" parameter (in this very case FPS-SMB-In-TCP). Use Get-NetFirewallRule command to get all the correct names for your rules.






            share|improve this answer
































              0














              Type this in an elevated powershell prompt :



              Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private


              It worked for me on Windows 10 1703






              share|improve this answer























              • what about if the entire group "File And Printer Sharing" does not exist inbound?

                – Hicsy
                Apr 15 at 3:04


















              0














              Building on @Mulder's answer, to enable it for private mode, it needs to be set specifically for each rule in "Windows Defender Firewall with Advanced Security".




              To run Windows Defender Firewall with Advanced Security


              Run the following in an Administrative Powershell window ... to review possible rules:

              "C:WINDOWSsystem32mmc.exe" "C:WINDOWSsystem32wf.msc" 



              To allow access for File/Print only on private network



              Run the following in an Administrative Powershell window.



              # Allow access to administrative shares through firewall [Ref: https://serverfault.com/a/739272]
              netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (LLMNR-UDP-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Datagram-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Name-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Session-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC)" dir=in profile=private new enable=Yes
              netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC-EPMAP)" dir=in profile=private new enable=Yes





              share|improve this answer























                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "2"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f516920%2fenable-file-and-print-sharing-command-line-how-to-enable-it-just-for-profile-p%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                2














                You are activating a preset rule, and I am guessing that the preset rule has Profile=any in it.



                Try this first:



                netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private





                share|improve this answer

























                • Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                  – user1866880
                  Jun 19 '13 at 20:31












                • oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                  – Rod MacPherson
                  Jun 19 '13 at 20:54















                2














                You are activating a preset rule, and I am guessing that the preset rule has Profile=any in it.



                Try this first:



                netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private





                share|improve this answer

























                • Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                  – user1866880
                  Jun 19 '13 at 20:31












                • oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                  – Rod MacPherson
                  Jun 19 '13 at 20:54













                2












                2








                2







                You are activating a preset rule, and I am guessing that the preset rule has Profile=any in it.



                Try this first:



                netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private





                share|improve this answer















                You are activating a preset rule, and I am guessing that the preset rule has Profile=any in it.



                Try this first:



                netsh advfirewall firewall set rule group="File and Printer Sharing" new profile=private






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 11 '17 at 9:27









                Gerald Schneider

                7,14832748




                7,14832748










                answered Jun 19 '13 at 14:10









                Rod MacPhersonRod MacPherson

                20116




                20116












                • Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                  – user1866880
                  Jun 19 '13 at 20:31












                • oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                  – Rod MacPherson
                  Jun 19 '13 at 20:54

















                • Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                  – user1866880
                  Jun 19 '13 at 20:31












                • oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                  – Rod MacPherson
                  Jun 19 '13 at 20:53











                • File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                  – Rod MacPherson
                  Jun 19 '13 at 20:54
















                Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                – user1866880
                Jun 19 '13 at 20:31






                Tried it, failed. Error: Only the enable parameter can be used to update rules specified by a group.. But thx for the reply.

                – user1866880
                Jun 19 '13 at 20:31














                oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                – Rod MacPherson
                Jun 19 '13 at 20:53





                oops I guess you can't edit the groups, or even show them with netsh. File and Printer sharing group contains these rules:

                – Rod MacPherson
                Jun 19 '13 at 20:53













                File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                – Rod MacPherson
                Jun 19 '13 at 20:53





                File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing (LLMNR-UDP-In) File and Printer Sharing (LLMNR-UDP-Out) File and Printer Sharing (NB-Datagram-In) File and Printer Sharing (NB-Datagram-Out)

                – Rod MacPherson
                Jun 19 '13 at 20:53













                File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                – Rod MacPherson
                Jun 19 '13 at 20:54





                File and Printer Sharing (NB-Name-In) File and Printer Sharing (NB-Name-Out) File and Printer Sharing (NB-Session-In) File and Printer Sharing (NB-Session-Out) File and Printer Sharing (SMB-In) File and Printer Sharing (SMB-Out) File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing (Spooler Service - RPC)

                – Rod MacPherson
                Jun 19 '13 at 20:54













                4














                netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=public|private|domain new enable=Yes|No


                To set three profiles together at one time, use:



                netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes


                The rule name must be changed in your local language, for example:



                netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes


                Don't forget to run as an administrator.






                share|improve this answer





























                  4














                  netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=public|private|domain new enable=Yes|No


                  To set three profiles together at one time, use:



                  netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes


                  The rule name must be changed in your local language, for example:



                  netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes


                  Don't forget to run as an administrator.






                  share|improve this answer



























                    4












                    4








                    4







                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=public|private|domain new enable=Yes|No


                    To set three profiles together at one time, use:



                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes


                    The rule name must be changed in your local language, for example:



                    netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes


                    Don't forget to run as an administrator.






                    share|improve this answer















                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=public|private|domain new enable=Yes|No


                    To set three profiles together at one time, use:



                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in new enable=Yes


                    The rule name must be changed in your local language, for example:



                    netsh advfirewall firewall set rule name="檔案及印表機共用 (SMB-In)" dir=in profile=private new enable=Yes


                    Don't forget to run as an administrator.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 27 '15 at 7:40









                    HBruijn

                    58.4k1191155




                    58.4k1191155










                    answered Nov 27 '15 at 7:14









                    MulderMulder

                    411




                    411





















                        0














                        Circling around the subject there are rare cases when using local language names doesn't work, ie. Polish Udostępnianie plików i drukarek (SMB — ruch przychodzący) = File and Printer Sharing (SMB-In). I believe this has something to do with UTF-8 handling in netsh as there are reports that using netsh for connecting to UTF-named wifi networks sometimes doesn't work too.



                        In those cases use PowerShell's Set-NetFirewallRule and language-agnostic "Name" parameter (in this very case FPS-SMB-In-TCP). Use Get-NetFirewallRule command to get all the correct names for your rules.






                        share|improve this answer





























                          0














                          Circling around the subject there are rare cases when using local language names doesn't work, ie. Polish Udostępnianie plików i drukarek (SMB — ruch przychodzący) = File and Printer Sharing (SMB-In). I believe this has something to do with UTF-8 handling in netsh as there are reports that using netsh for connecting to UTF-named wifi networks sometimes doesn't work too.



                          In those cases use PowerShell's Set-NetFirewallRule and language-agnostic "Name" parameter (in this very case FPS-SMB-In-TCP). Use Get-NetFirewallRule command to get all the correct names for your rules.






                          share|improve this answer



























                            0












                            0








                            0







                            Circling around the subject there are rare cases when using local language names doesn't work, ie. Polish Udostępnianie plików i drukarek (SMB — ruch przychodzący) = File and Printer Sharing (SMB-In). I believe this has something to do with UTF-8 handling in netsh as there are reports that using netsh for connecting to UTF-named wifi networks sometimes doesn't work too.



                            In those cases use PowerShell's Set-NetFirewallRule and language-agnostic "Name" parameter (in this very case FPS-SMB-In-TCP). Use Get-NetFirewallRule command to get all the correct names for your rules.






                            share|improve this answer















                            Circling around the subject there are rare cases when using local language names doesn't work, ie. Polish Udostępnianie plików i drukarek (SMB — ruch przychodzący) = File and Printer Sharing (SMB-In). I believe this has something to do with UTF-8 handling in netsh as there are reports that using netsh for connecting to UTF-named wifi networks sometimes doesn't work too.



                            In those cases use PowerShell's Set-NetFirewallRule and language-agnostic "Name" parameter (in this very case FPS-SMB-In-TCP). Use Get-NetFirewallRule command to get all the correct names for your rules.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited May 11 '17 at 9:28









                            Gerald Schneider

                            7,14832748




                            7,14832748










                            answered May 11 '17 at 9:27









                            MatiasMatias

                            1




                            1





















                                0














                                Type this in an elevated powershell prompt :



                                Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private


                                It worked for me on Windows 10 1703






                                share|improve this answer























                                • what about if the entire group "File And Printer Sharing" does not exist inbound?

                                  – Hicsy
                                  Apr 15 at 3:04















                                0














                                Type this in an elevated powershell prompt :



                                Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private


                                It worked for me on Windows 10 1703






                                share|improve this answer























                                • what about if the entire group "File And Printer Sharing" does not exist inbound?

                                  – Hicsy
                                  Apr 15 at 3:04













                                0












                                0








                                0







                                Type this in an elevated powershell prompt :



                                Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private


                                It worked for me on Windows 10 1703






                                share|improve this answer













                                Type this in an elevated powershell prompt :



                                Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True -Profile Private


                                It worked for me on Windows 10 1703







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Aug 30 '17 at 23:36









                                Anthony HocquetAnthony Hocquet

                                115




                                115












                                • what about if the entire group "File And Printer Sharing" does not exist inbound?

                                  – Hicsy
                                  Apr 15 at 3:04

















                                • what about if the entire group "File And Printer Sharing" does not exist inbound?

                                  – Hicsy
                                  Apr 15 at 3:04
















                                what about if the entire group "File And Printer Sharing" does not exist inbound?

                                – Hicsy
                                Apr 15 at 3:04





                                what about if the entire group "File And Printer Sharing" does not exist inbound?

                                – Hicsy
                                Apr 15 at 3:04











                                0














                                Building on @Mulder's answer, to enable it for private mode, it needs to be set specifically for each rule in "Windows Defender Firewall with Advanced Security".




                                To run Windows Defender Firewall with Advanced Security


                                Run the following in an Administrative Powershell window ... to review possible rules:

                                "C:WINDOWSsystem32mmc.exe" "C:WINDOWSsystem32wf.msc" 



                                To allow access for File/Print only on private network



                                Run the following in an Administrative Powershell window.



                                # Allow access to administrative shares through firewall [Ref: https://serverfault.com/a/739272]
                                netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (LLMNR-UDP-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Datagram-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Name-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Session-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC)" dir=in profile=private new enable=Yes
                                netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC-EPMAP)" dir=in profile=private new enable=Yes





                                share|improve this answer



























                                  0














                                  Building on @Mulder's answer, to enable it for private mode, it needs to be set specifically for each rule in "Windows Defender Firewall with Advanced Security".




                                  To run Windows Defender Firewall with Advanced Security


                                  Run the following in an Administrative Powershell window ... to review possible rules:

                                  "C:WINDOWSsystem32mmc.exe" "C:WINDOWSsystem32wf.msc" 



                                  To allow access for File/Print only on private network



                                  Run the following in an Administrative Powershell window.



                                  # Allow access to administrative shares through firewall [Ref: https://serverfault.com/a/739272]
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (LLMNR-UDP-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Datagram-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Name-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Session-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC)" dir=in profile=private new enable=Yes
                                  netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC-EPMAP)" dir=in profile=private new enable=Yes





                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    Building on @Mulder's answer, to enable it for private mode, it needs to be set specifically for each rule in "Windows Defender Firewall with Advanced Security".




                                    To run Windows Defender Firewall with Advanced Security


                                    Run the following in an Administrative Powershell window ... to review possible rules:

                                    "C:WINDOWSsystem32mmc.exe" "C:WINDOWSsystem32wf.msc" 



                                    To allow access for File/Print only on private network



                                    Run the following in an Administrative Powershell window.



                                    # Allow access to administrative shares through firewall [Ref: https://serverfault.com/a/739272]
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (LLMNR-UDP-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Datagram-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Name-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Session-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC-EPMAP)" dir=in profile=private new enable=Yes





                                    share|improve this answer













                                    Building on @Mulder's answer, to enable it for private mode, it needs to be set specifically for each rule in "Windows Defender Firewall with Advanced Security".




                                    To run Windows Defender Firewall with Advanced Security


                                    Run the following in an Administrative Powershell window ... to review possible rules:

                                    "C:WINDOWSsystem32mmc.exe" "C:WINDOWSsystem32wf.msc" 



                                    To allow access for File/Print only on private network



                                    Run the following in an Administrative Powershell window.



                                    # Allow access to administrative shares through firewall [Ref: https://serverfault.com/a/739272]
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv6-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (LLMNR-UDP-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Datagram-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Name-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (NB-Session-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC)" dir=in profile=private new enable=Yes
                                    netsh advfirewall firewall set rule name="File and Printer Sharing (Spooler Service - RPC-EPMAP)" dir=in profile=private new enable=Yes






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered May 21 at 23:39









                                    CJBSCJBS

                                    1216




                                    1216



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Server Fault!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f516920%2fenable-file-and-print-sharing-command-line-how-to-enable-it-just-for-profile-p%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                                        Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                                        What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company