cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8087
Views
6
Helpful
1
Comments
Kt43387
Level 1
Level 1

import netmiko
from netmiko import ConnectHandler
device = ConnectHandler(device_type="cisco_ios", ip="DEVICE IP", username="USERNAME", password="PASSWORD")
output1 = device.send_command("show running-config")
save_file = open("Switch_running.txt","w")
save_file.write(output1)
save_file.close()
device.disconnect()

#python#automation#

Comments
sagrai
Cisco Employee
Cisco Employee

Working command is below:

 

from netmiko import ConnectHandler

iou1 = {
'device_type': 'cisco_ios',
'ip': '172.16.221.106',
'username': 'admin',
'password': 'cisco',
}

device = ConnectHandler(**iou1)

output1 = device.send_command("show running-config")
save_file = open("Switch_running.txt","w")
save_file.write(output1)
save_file.close()
device.disconnect()

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: