In Windows 10, the user interface is 'hidden' in the services.msc Properties of the SNMP Service itself. For more info, see this Paessler THe Network Monitoring Company Knowledge Base page for details. 3 Configuration - Windows Registry. All the SNMP settings are stored in registry, which makes this task a bit easier. To harden SNMP security one must deviate from the default get community string of 'public'. Once that is done, as well as disabling any remaining get community strings of 'public' such as HP units, there are two options to maintain printing functionality: Uncheck the SNMP Status Enabled checkbox for the affected printer on the client machine.
On Windows 7 / 8[.1], you can configure printer and port information via the command line as the administrator, for example:
will list the printers attached to computer-01
, using my logged-in credentials. This produces many lines of output, including the printer port. My goal is to find the Printer Port, assuming it's a TCP/IP port, then run the prnport
command to disable SNMP Status on that port. Below is a sample output of two different printers, on being USB, the other being a TCP/IP printer:
(Note: this is not an X-Y problem, the issue is known to the manufacturer and disabling SNMP is the known solution.)
How can I find the Port Name that happens to be a TCP/IP port, and put it to a variable that I can run against the prnport
command?
1 Answer
One problem you'll have is that the port name is free text: it can be just about anything; it is not guaranteed to be the IP address. Unless you're sure that the people setting up the printers explicitly set the names to start with IP_
, that is not guaranteed.
I would recommend using PowerShell if you are able; the Get-PrinterPort
and Set-PrinterProperty
or maybe Set-PrintConfiguration
cmdlets (Win10 docs, Win8 docs, Win8.1 docs) look very useful. Unfortunately, they're only available on Windows 8 or Server 2012 and newer. I only have access to Windows 7 at the moment and am unable to test them.
Failing that, you can use prnport
directly rather than going through prnmngr
first. prnport -l
will 'list all TCP ports'. If you use this in conjunction with a script similar to David's, you'll end up with the correct results:
NB: You may need to substitute prnport
invocations with cscript %windir%System32Printing_Admin_Scriptsen-USprnport.vbs
depending on your setup. Also, the region en-US
can change.
Brief explanation:
- This is an expanded
for
loop. Seefor /?
for details. - We're looping through all
Port name foo
lines in the output and takingfoo
from them. - By specifying
tokens=1,2,*
, we tokenise the result string by spaces and set%%a
toPort
,%%b
toname
and%%c
to everything after (that's what the asterisk means).
You'll probably want to pass the computer name in as another variable.
Also note that this does not handle cases where no TCP/IP printers exist. I assume they'll just do nothing since the loop body should never execute.
Another option is to use WMI directly, which is what the printer management scripts do under the hood.
BobBobNot the answer you're looking for? Browse other questions tagged windows-7printernetwork-printer or ask your own question.



Whether or not to use SNMP is pretty much a personal choice. The bottom line is whether the information you are getting via SNMP is useful and unique (i.e. you can *only* get it from SNMP and you need that info to manage things efficiently/effectively). Just be aware that there are security risks if it's not configured properly.
http://www.lovemytool.com/blog/2012/03/enabling-snmp-worth-security-risks-by-chris-greer.html
http://msdn.microsoft.com/en-us/library/aa909970.aspx
Old, but still worth a read:
http://www.techrepublic.com/article/lock-it-down-dont-allow-snmp-to-compromise-network-security/1036978
Regardless of whether you use it or not, here's a good post on how to configure it:
http://social.technet.microsoft.com/Forums/en-US/windowsserver2008r2management/thread/06b48ced-1bb1-4adf-91e1-2dc8502e0273/
Since it can be managed through registry settings, this is a prime candidate for policy enforcement (scripts) via the K1000. Just figure out what registry setting you want to have in place, then go to Scripting > Configuration Policy > Enforce Registry Settings to setup your enforcement script.
Hope that helps!
Disable Snmp Windows 7
John