I got the following error while pushing multiple targets..
These occured when I tried this way -
$targets ="1.2.3.4/mycommunity", "5.6.7.8/mycommunity", "9.1.2.3/mycommunity"...
I also tried passing them as $target1, $target2... but it seems to be overwriting the current target and the final target host is what I see when the script is done.. Please help..
The remote server returned an error: (500) Internal Server Error.:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>
Single field targets provided multiple times
while parsing call information for method VimEsxCLIsystemsnmpset
at line 4, column 4
while parsing SOAP body
at line 3, column 2
while parsing SOAP envelope
at line 2, column 0
while parsing HTTP request for method set
on object of type vim.EsxCLI.system.snmp
at line 1, column 0</faultstring><detail><InvalidRequestFault xmlns="urn:vim25" xsi:type="InvalidRequest"></InvalidRequestFault></detail></soapenv:
Fault>
</soapenv:Body>
</soapenv:Envelope>
At C:\Users\myname\AppData\Local\Temp\aaefd9b8-5830-4896-9398-12114869c044.ps1:41 char:24
+ $esxcli.system.snmp.set <<<< ($authentication,$communities,$enable,$engineid,$hwsrc,$loglevel,$notraps,$port,$privacy,$remoteusers,$reset,$syscon
tact,$syslocation,$targets,$users,$v3targets)
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodInvocationException
Root element is missing.
At C:\Users\mynameAppData\Local\Temp\aaefd9b8-5830-4896-9398-12114869c044.ps1:43 char:24
+ $esxcli.system.snmp.get <<<< ()
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodInvocationException