netsh advfirewall firewall to change an existing rule's remoteip

Hii Sing Chung 21 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 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,274 questions
0 comments No comments
{count} votes

Accepted answer
  1. Candy Luo 12,656 Reputation points Microsoft Vendor
    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