> For the complete documentation index, see [llms.txt](https://docs.editran.onesait.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.editran.onesait.com/documentacion-editran/open-v5.3-en/windows/versionado_envio_clave_propia.md).

# Practical Examples

This procedure explains how to automate the generation of a new version of the key of a proprietary subsystem and its sending to a selection of remotes using the product commands.

## Requirements and prior considerations

* Planning\
  The generation of the new version of the key and its sending to the remotes must be carried out according to a previously defined schedule.
* Concurrency with processes on remotes\
  It must not coincide with key-sending processes initiated from the remotes themselves.\
  The procedure uses the TELEGC presentation to send the export file of the local key. If a remote sends its key in parallel, these files may be overwritten, altering the flow and causing errors.
* Scope\
  This procedure only applies to remotes that already have an active version of the key. It is not valid for new remotes, since it does not perform the initial creation of TELEGC presentations.
* Prior key status\
  Before running the process, the key must be active on all listed remotes and there must not already be a newly generated version.
* Error behavior\
  If the generation of the new version of the key fails with the first remote, the process is interrupted immediately (no version is created; it cannot continue). In all other cases, the process does not stop: it continues with the next remote, logging both successful operations and errors.

## Execution guarantees

* The log should be reviewed to identify whether there are remotes that have had problems during the generation of the new version and/or its sending.
* Finishing without errors on a remote only confirms that the sending was carried out without incidents. It is essential to manually verify that the new version of the key is active both on the local system and on all remotes.

## Script

Below is an example of a script for creating the new version of subsystem N associated with local W00000010 and sending it to remotes L00000010 and L00000110.

```bat
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

REM --- Log and parameter configuration ---
set "LOGDIR=C:\Editran\log"
set "LOGFILE=%LOGDIR%\versionadoSubsistema.log"
set "LOCAL=W00000010"
set "SUBSISTEMA=N"
set "NBITS=4096"
REM List of remotes separated by a space
set "REMOTOS=L00000010 L00000110"

REM Script return
set "RET=0"

echo Generating new version of local subsystem %SUBSISTEMA% ... > "%LOGFILE%"

set "FIRST=1"
set "VFIRST=-v"

for %%R in (%REMOTOS%) do (
    echo.>> "%LOGFILE%"
    echo Processing remote: %%R>> "%LOGFILE%"

    REM Build gc_config command (with -v only for the first remote)
    if "!FIRST!"=="1" (
        set "FIRST=0"
    ) else (
        set "VFIRST="
    )

    REM execute gc_config
    gc_config !VFIRST! -k!NBITS! -l!LOCAL! -r%%R -s!SUBSISTEMA! >> "%LOGFILE%" 2>&1
    set "RC=!ERRORLEVEL!"
    if "!RC!"=="1" (
        timeout /t 3 /nobreak >nul
        
        set "TELEGC=!LOCAL!-%%R-TELEGC"
        echo Sending !TELEGC! ... >> "%LOGFILE%"
        
        REM execute igacmd
        igacmd -o Send -p "!TELEGC!" -w -v >> "%LOGFILE%" 2>&1
        if "!ERRORLEVEL!"=="0" (
            echo The new version of subsystem %SUBSISTEMA% with local %LOCAL% was sent correctly to remote %%R >> "%LOGFILE%"
        ) else (
            echo Error sending the new version of subsystem %SUBSISTEMA% with local %LOCAL% to remote %%R >> "%LOGFILE%"
            set "RET=1"
        )
    ) else (        
        echo Error generating the new version of subsystem %SUBSISTEMA% with local %LOCAL% and remote %%R >> "%LOGFILE%"        
        set "RET=1"

        if "!VFIRST!"=="-v" (
            goto end
        )
    )

    timeout /t 3 /nobreak >nul
)

:end
ENDLOCAL & set "RET=%RET%"
exit /b %RET%
```

> *Note*:\
> In this script the gc\_config command is used to generate the new version of the key of a subsystem. It is important to understand that:
>
> * The -v parameter indicates that a new version of the key must be created.
> * This operation is performed only once, with the first remote in the list. This ensures that a single consistent version is generated.
> * In subsequent iterations, gc\_config does not include -v, because the version created in the first execution already exists. In these calls, the command simply applies that version to the other remotes.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.editran.onesait.com/documentacion-editran/open-v5.3-en/windows/versionado_envio_clave_propia.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
