Monday, December 28, 2009

Script to turn off PoE power using Energywise

My environment: Cisco 3560E

Besides shutting down the switchport, you can turn off the PoE power via the Energywise command.  Before you run this script, setup your energywise domain with the command “energywise domain panda security shared-secret eatsbamboo”

#!/usr/bin/expect

set timeout 5
log_user 1
set hostlist "pandasw01"
set prompt "pandasw01"
foreach host $hostlist {
#set prompt [append $host "#"]
set promptcfg [append $prompt "(config)#"]
spawn telnet $host
expect $prompt
send "conf t\r"
expect $promptcfg
send "int range fa0/1 - 23\r"
expect $promptcfg
send "energywise level 0\r"
expect $promptcfg
send "end\r"
expect $prompt
send "exit\r"
}