On Windows and Linux you do not need the GUI to execute code. The GUI is only a DIFFERENT way to access the SAME code. Remember DOS?
Anyway, telnet works in two ways, either Command Shell ot text-mode, or it can overlay the desktop - i.e. Remote Desktop Connection.
You'll need the appropriate telnet server on the remote machine. Both systems include text-mode telnet services.
Then connect your client, log in, and execute your command, or don't you know OS commands?
In the Unix world the GUi is provided by something called the X server. It was conceived to be network-aware. The programs wanting to access the GUi rosurces (one of the potentially several logical/physical displays, keyboard, pointing device etc.) are clients to the X server, which handles those GUI resources.
So in order to run GUI-programs on a Unix (or VMS box), you need an X server on the machinje which handles the GUI devices. If it is a windows ox, you need then an X server for Windows. There are commercial ones and as if Red Hat were shipped with a free one.