I am trying to automate tasks in packet trace version 8.2.1, and I am trying to run some commands on a group of routers using a Python script as described by chatGPT. Here is the script:
# Define the list of routers and the command to run
routers = ["R01", "R02", "R03","R04", "R05", "R06", "R07"]
command1 = "config t" + "\n"
command2 = "no ip router eigrp 22" + "\n"
command3 = "do wr" + "\n"
commands = command1 + command2 + command3
Define the username and password for the routers
username = ""
password = ""
Loop through each router and run the command
for router in routers:
print("Connecting to " + router + "...")
os.system("vpcs " + router + " sendcmd 'enable\n" + password + "\n" + username + "\n" + password + "\n" + commands + "'")
print("Command executed on " + router)
I added both Paython and Packet Tracer Folders to the Windows Systenm Variable PATH.
The script output:
C:\Program Files\Python311>C:\Users\Khaled\OneDrive\Documents\Training\Cisco\CCNA\Notes\PS4PT001.PY
Connecting to R01...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R01
Connecting to R02...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R02
Connecting to R03...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R03
Connecting to R04...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R04
Connecting to R05...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R05
Connecting to R06...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R06
Connecting to R07...
'vpcs' is not recognized as an internal or external command,
operable program or batch file.
Command executed on R07
C:\Program Files\Python311>
I understand that vpcs is the component that helps Packet Tracer to Run Virtual PCs, but it does not seem reachable from outside it for some reason.
I dug on the Internet for a way to enable it or add it to Packet Tracer with no luck.
I tried to ask on the stack network engineers but this kind of question seems not acceptable there because as they said when they closed a similar question: "It is not practical or related to the real production problems".
So, I hope this is the correct place where at last I will find a satisfying answer.
How to get the script to work?
How to use the 'vpcs' with Cisco Packet Tracer?