SynopsisConfigures the SNMP trap communities and destinations on a local or remote computer.
- Set-SNMPTrapCommunity [-TrapCommunity] [-TrapDestination] [-ComputerName] [-Credential]
DescriptionThe Set-SNMPTrapCommunity cmdlet is used to add or remove SNMP trap communities and trap destinations on the local or a remote computer.
- TrapCommunity Add this trap community to the computer. When adding a trap community you must also specify the TrapDestination parameter.
- TrapDestination Add this trap destination to the specified trap community. When adding a trap destination you must specify the TrapCommunity parameter.
- ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
- Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.
InputsSet-SNMPTrapCommunity accepts the output of Get-SNMPTrapCommunity as an input object. In addition, the TrapCommunity, TrapDestination and ComputerName parameters each accept pipeline input by property name.
OutputsSet-SNMPTrapCommunity makes changes directly to Windows and does not output any Powershell objects.
NotesThe Set-SNMPTrapCommunity cmdlet requires that the RPC service is started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1In this command the SNMP service of the local computer is configured to add the trap community monitoring and the trap destination 192.168.1.44:
Set-SNMPTrapCommunity -TrapCommunity Monitoring -TrapDestination 192.168.1.44
Example 2The Set-SNMPTrapCommunity cmdlet can be used in conjunction with the Get-SNMPTrapCommunity cmdlet. In this example the trap communities and destinations on computer PC01 are replicated on computer PC02:
Get-SNMPTrapCommunity -Computer PC01 | Set-SNMPTrapCommunity -Computer PC02