If you receive pop-up messages from off-network spammers, I know of two methods to prevent it:
1. You can close the following ports to outside traffic:
UDP ports 135, 137, and 138
TCP ports 135, 139, and 445
but the messenger service also uses an ephemeral port number greater than 1024.
NOTE: An ephemeral port is a short-lived port.
2. Use Local Security Policy, Domain Security Policy, and/or Domain Controller Security Policy to navigate to Local Policies / User Rights Assignment. Double-click Access this computer from the network and Remove or uncheck the right from the Everyone group and add it to the Authenticated Users security group. You can also use: