ā01-20-2026 03:54 AM
Hi Experts,
Need your help one more time š
I am configuring EEM script for switches backup but i facing below errors
Configured command -
action 25.0 cli command "copy running-config ftp://CISCOSWITCH:Passwd@192.168.10.10/SWITCH/IN/$h/$h-$t abc.txt"
Error -
%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: h
Could you please help me here
Thanks a lot in advanced
ā01-20-2026 04:28 AM
Hello @surazb,
Do you have the command
cli command āenableā
in your script before the copy command?
can you share the script in order to better understand the issue?
Hope this helps.
Liviu
ā01-20-2026 04:36 AM
Here configured commands
action 15.0 cli command "enable"
action 20.0 cli command "term len 0"
action 25.0 cli command "copy running-config ftp://CISCOSWITCH:Passwd@192.168.10.10/SWITCH/IN/$h/$h-$t abc.txt"
ā01-20-2026 04:48 AM
Do you have
ftp username
ftp password
configured on the device?
ā01-20-2026 04:50 AM
Yes, it is there and that is working fine
ā01-20-2026 05:46 AM
The link provided by @Mark Elsen points to a possible cause for your issue.
If you have a support contract for your device, you can contact TAC for further investigation.
Hope this helps.
Liviu
ā01-20-2026 04:31 AM
- @surazb FYI : https://bst.cisco.com/bugsearch/bug/CSCvg53802?rfs=qvred
M.
ā01-25-2026 07:18 AM
The error occurs because $h is not a predefined EEM environment variable. You must explicitly define it using event manager environment h <value> (for example, the hostname), or use a built-in variable like $_hostname. Replace $h with $_hostname (and $t with a supported time variable) to resolve the issue.
ā01-25-2026 08:50 AM - edited ā01-25-2026 08:53 AM
how is your whole EEM Script looks like and what device model is this ? -
Quick example :
event manager applet BACKUP_TO_FTP
event timer cron name DAILY_BACKUP cron-entry "0 0 * * *" ! Runs daily at midnight
action 1.0 info type routername
action 2.0 cli command "enable"
action 3.0 cli command "show clock"
action 4.0 regexp "([0-9:]+) ([A-Z]+) ([A-Za-z]+) ([0-9]+) ([0-9]+)" "$_cli_result" match time timezone month day year
action 5.0 cli command "copy running-config ftp://CISCOSWITCH:Passwd@192.168.10.10/SWITCH/IN/$_info_routername/$_info_routername-$year-$month-$day-$time.txt"
follow below detailed example to define variables :
https://www.balajibandi.com/?p=1554
=====Preenayamo Vasudevam=====
***** Rate All Helpful Responses *****
ā01-26-2026 04:15 AM
The error occurs because EEM does not recognize $h and $t as valid environment variables. In EEM, you must use supported variables such as $_hostname or explicitly define variables using event manager environment before referencing them in the script. Once properly defined, the copy command should execute without errors.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide