Created
December 14, 2021 18:13
-
-
Save primeinc/bea3b94de902261811ba2e5f32c9eab0 to your computer and use it in GitHub Desktop.
Quick and dirty SNMP command to turn on and off an outlet using powershell / windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick and dirty SNMP command to turn on and off an outlet using powershell / windows | |
#.iso.org.dod.internet.private.enterprises.cps.products.hardware.ePDU.ePDUOutlet.ePDUOutletControl.ePDUOutletControlTable.ePDUOutletControlEntry.ePDUOutletControlOutletCommand | |
# .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4 | |
# .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5 for outlet number 5 | |
$SNMP = New-Object -ComObject olePrn.OleSNMP | |
$SNMP.open('192.168.10.100','private',2,1000) | |
#$RESULT = $SNMP.Get(".1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5") | |
$ACTION = 3 | |
$RESULT = $SNMP.Set(".1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5", $ACTION) | |
$SNMP.Close() | |
$RESULT | |
Read-Host -Prompt "Outlet 5 has been rebooted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment