netsh advfirewall firewall to change an existing rule's remoteip

Hii Sing Chung 26 Reputation points
2021-03-30T03:06:15.053+00:00

I would like to make a change to an existing Windows Firewall rule, the 'File and Printer Sharing (SMB-in)" private profile remoteip. By default Windows set the private profile remoteip to 'localsubnet', I want to change this to 'any'. I have thousands of Windows computers on the network and I find that they randomly set their network profile to private or public and I don't know the reason behind them. I have tried to use the set-netconnectionprofile to change their network profile to private or public, vice versa but I find that after restart their revert the netconnectionprofile. Because of this problem, I would like to change the default rule of the "File and Printer Sharing (SMB-in)" remoteip to any on the private profile if a computer keeps setting its network connection profile to private. I had tried these: netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-in)" profile=private remoteip=any This shows error "For 'set' command, the 'new' keyword must be present and must not be the last argument provided. netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-in)" profile=private new remoteip=any This shows error "No rule match the specified criteria". What need to be done to make it correct?

Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-03-30T07:52:06.64+00:00

    Hi ,

    Please run the command of netsh advfirewall firewall set rule name="File and Printer Sharing (SMB-In)" new profile=private remoteip=any , as picture below:

    82663-image.png

    Best Regards,
    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.