powershellscripts.com

Tutorials  PowerShell Cmdlet Help for Set-VMHostSnmp



NAME
Set-VMHostSnmp

SYNOPSIS
Updates the host SNMP configuration.

SYNTAX
Set-VMHostSnmp [-HostSnmp] [-Enabled []] [-Port ] [-ReadOnlyCommunity ] [-
WhatIf] [-Confirm] []

Set-VMHostSnmp [-HostSnmp] [-Enabled []] [-Port ] [-ReadOnlyCommunity ] [-
TargetCommunity ] [-TargetPort ] [-TargetHost ] -RemoveTarget [-WhatIf] [-Confirm] [ arameters>]

Set-VMHostSnmp [-HostSnmp] [-Enabled []] [-Port ] [-ReadOnlyCommunity ] -T
argetCommunity [-TargetPort ] -TargetHost -AddTarget [-WhatIf] [-Confirm] [ rs>]

Set-VMHostSnmp [-HostSnmp] [-Enabled []] [-Port ] [-ReadOnlyCommunity ] [-
RemoveTarget] -TrapTargetToRemove [-WhatIf] [-Confirm] []


DESCRIPTION
Updates the host SNMP configuration. If specified, adds or removes a trap target (removing can be specified by eith
er TrapTargetToRemove parameter or by any of the following parameters (or combination of them): TargetCommunity, Ta
rgetHost, TargetPort). If the user passes null, an empty array or string to the ReadOnlyCommunities parameter, the
old values of this property are erased. This results in a NULL value of this property of the output object.


PARAMETERS
-HostSnmp
Specify the host Snmp object you want to modify.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Enabled []
Indicate that the SNMP feature is enabled on the specified host.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Port
Specify the port on which the host listens to SNMP messages.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-ReadOnlyCommunity
Provide a list of communities, identifying who is able to send SNMP requests to that host. If null, an empty ar
ray or string are passed to this parameter, its old values are erased and the output object for the ReadOnlyCom
munity property is an empty array. In PowerShell an empty array is defined by @().

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf
Indicate that the cmdlet is run only to display the changes that would be made and actually no objects are modi
fied.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Confirm
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.

Required? false
Position? named
Default value $true
Accept pipeline input? false
Accept wildcard characters? false

-TargetCommunity
Specify the community identifier of the trap target.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-TargetPort
Specify the port on which the target host listens to SNMP messages.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-TargetHost
Specify the identifier of the target host - a host name or an IP address.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-RemoveTarget
Indicate that you want to remove a trap target from the host SNMP configuration. There are two ways to specify
a trap target: 1) pass the trap target to the TrapTargetToRemove parameter; 2) use a combination of the TargetC
ommunity, TargetHost, and TargetPort parameters to specify a criteria (for example, remove all trap targets tha
t are using port 162).

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-AddTarget
Indicate that you want to add a new trap target to the host SNMP configuration. A trap target consists of three
elements - Community (mandatory), HostName (mandatory), Port (optional - defaults to 162), specified by the Ta
rgetCommunity, TargetHost, and TargetPort parameters.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-TrapTargetToRemove
Specify the trap target you want to remove. The trap target can be obtained from the "TrapTargets" property of
the HostSNMP object (an array of TrapTarget objects).

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false


This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
VmHostSnmp


NOTES


The vSphere server must be a connection to an ESX host.

-------------- Example 1 --------------

C:\PS>$hostSNMP = Get-VMHostSNMP

$hostSNMP = Set-VMHostSNMP $hostSNMP -Enabled:$true -ReadOnlyCommunity 'secret'


Enables SNMP on a virtual machine host.





-------------- Example 2 --------------

C:\PS>Get-VMHostSnmp | Set-VMHostSnmp -ReadonlyCommunity @()


Sets the virtual machine host Snmp by erasing the old value of the ReadOnlyCommunity parameter.






RELATED LINKS
Online version: http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/Set-VMHostSnmp.html
Get-VMHostSNMP
Test-VMHostSNMP