Add-TpmsSnmpInfo

17 views 0

Beschreibung

Aktiviert den Empfang der SNMP-Information bei eine Standard TCP/IP Port.

Syntax

Add-TpmsSnmpInfo -TcpIpPorts <PSObject[]> [-Enabled <boolean>] [-DeviceIndex <uint32>] [-Community <String>]

Parameter Beschreibung
-TcpIpPorts Name des Standard TCP/IP Ports (siehe Port Name)
-Enabled aktiviert den Empfang von SNMP-Info (siehe SNMP Status Enabled)

1: aktiviert

0: deaktiviert

-DeviceIndex siehe SNMP Device Index
-Community siehe Community Name

SNMP-Info in den Port-Eigenschaften

Beispiel 1: Gebrauch des Cmdlets

Die folgenden beiden Beispiele fügen einem Standard TCP/IP Port die Optionen SNMP Status Enabled, Com­munity Name und SNMP Device Index mit Hilfe der Variable $port hinzu.

Vergleiche hierzu New-TpmsObjTcpIpPortRaw.

Add-TpmsSnmpInfo -TcpIpPorts ($port) -Enabled 1 -DeviceIndex 1 -Community public

$port = $port | Add-TpmsSnmpInfo -Enabled 1 -DeviceIndex 1 -Community public

Beispiel 2:

Skript mit dem Cmdlet Add-TpmsSnmpInfo

Das folgende Skript legt zehn Drucker mit Standard TCP/IP Ports an, die in einer CSV-Datei definiert sind – einschließlich der SNMP-Einstellungen.

  • Die Definitionsdatei network-printers.csv:
"Selected","PrinterName","PortName","Address","DriverName","TemplateName"

"1","PRN01-BLN","PRN01-BLN:","192.168.209.203","Lexmark T644 (MS)","Lexmark T644"

"1","PRN02-PRS","PRN02-PRS:","192.168.149.125","Kyocera FS-C8500DN","Kyocera FS-C8500DN"

"1","PRN03-WRS","PRN03-WRS:","192.168.149.127","Canon LBP7660C Class Driver","Canon LBP7660C"

"1","PRN04-PRG","PRN04-PRG:","192.168.149.126","Brother PCL6 Class Driver","Brother"

"1","PRN05-MSC","PRN05-MSC:","192.168.149.120","Xerox Phaser 6300N","Xerox Phaser 6300N"

"1","PRN06-LDN","PRN06-LDN:","192.168.149.124","Dell B1265dnf Laser MFP PCL6","Dell B1265dnf Laser MFP"

"1","PRN07-OSL","PRN07-OSL:","192.168.149.129","HP Color LaserJet 9500 PCL6 Class Driver","HP Color LaserJet 9500"

"1","PRN08-STK","PRN08-STK:","192.168.149.123","KONICA MINOLTA PS Color Laser Class Driver","KONICA MINOLTA PS Color Laser"

"1","PRN09-KPN","PRN09-KPN:","192.168.149.128","OKI PCL6 Class Driver","OKI"

"1","PRN10-BPT","PRN10-BPT:","192.168.149.122","Samsung ML-4555 Series PCL6","Samsung ML-4555"
  • Das PowerShell-Skript:
$allports = @()

$allprinters = @()

      Import-Csv -Path .\network-printers.csv | foreach {

         if($_.Selected -eq 1)    

         {       

            $port = New-TpmsObjTcpIpPortRaw -Name $_.PortName -PortNumber 9100 -HostAddress $_.Address

            Add-TpmsSnmpInfo -TcpIpPorts ($port) -Enabled 1 -DeviceIndex 1 -Community "public"

            $printer = New-TpmsObjPrinter -Name $_.PrinterName -Driver $_.DriverName -Port $_.PortName -Template $_.TemplateName

         }   

         $allports += $port

         $allprinters += $printer       

      }

      $srva = New-TpmsObjApplyAgent -Name "cps47.ourdomain.local" -Port 5050 -Printers ($allprinters) -Ports ($allports)    

      Start-TpmsApplyByAgent -Action Deploy -Servers ($srva) | Format-TpmsDispatch
Previous Page
Next Page

War dies hilfreich?