1

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?

Shadi
  • 149
  • 5
  • Are you sure `vpcs` is in fact a Packet Tracer component? From what I know, it is used by the GNS3 lab simulator but _not_ by Packet Tracer. – u1686_grawity May 08 '23 at 06:44
  • According to bing chat, **vpcs** stands for **Virtual PC Simulator** and is a program that allows you to simulate multiple PCs on a single machine. It can be used with network simulators such as **Cisco Packet Tracer** and **GNS3**. – Shadi May 08 '23 at 09:29
  • According to every other resource I've found, it is not _part of_ Packet Tracer – and it does not have a `sendcmd` subcommand anywhere in its source code, either (and, on top of that, it doesn't seem like it's capable of emulating any version of IOS), so I'm leaning strongly towards "ChatGPT made it up". – u1686_grawity May 08 '23 at 09:34
  • If `os.system("vpcs " + rest of arguments)` reports `'vpcs' is not recognized as an internal or external command`, then I would suggest that VPCS is not installed or not in the PATH. – Ljm Dullaart May 08 '23 at 09:46

0 Answers0