Mender-cli on windows and integration

The goal is to have a windows application enabling port forward from / to a certain port after picking the device ID.

How would you go about doing this?
I have almost no knowledge of the go programming language, so I was thinking of compiling the mender-cli for windows and just use that as an interface.
Is it difficult to compile it for windows as a single binary that contains everything? Like the linux download.

I have my own device ID “serialno” which I select in the mender UI. I guess this is not reflected in the tool and I have to resolve this to the GUID provided by Mender. Can this be done through the CLI?


cmd\portforward.go:260:27: undefined: unix.SIGINT
cmd\portforward.go:260:40: undefined: unix.SIGTERM
cmd\terminal.go:421:27: undefined: unix.SIGINT
cmd\terminal.go:421:40: undefined: unix.SIGTERM
cmd\terminal.go:457:32: undefined: syscall.SIGWINCH

Seems like it can’t build on windows?

I made it build on windows by getting rid of the signals

1 Like

Hello @emilm,

Personally I have not tried it on Windows. Does it work as expected on your end?

Please feel free to open a PR for a new branch at least if it makes sense.

Have a great day!

Hey! It works on Windows now but it needs to be properly have other handlers than the unix signals before it’s worthy of a PR I think!

Another thing - usually one don’t use the uuid provided from mender for the device ID. We use our own attribute as serial number. Is there any way to use mender connect not for the uuid, but our own serial number instead?
Or does the API and mender-cli need to be extended to support that kind of lookup?

Hey @emilm,

thats cool to hear! Would love to also give the Windows adaptation a spin. Did you only look into mender-cli or also mender-artifact by any chance?


Hey! Just mender-cli. Because that’s what I will use as an external executable from my tunneling tool.

Do you know if the API or mender-cli can extract the UUID needed for mender-connect by using your arbitrary attribute like my own “serialnumber” ? Or do I have to provide the mender device UUID through other means?

Hi @emilm,

Nice, and we definitely welcome improvements for using mender-cli on Windows.

Concerning your question, you can list the devices using mender-cli devices list, which provides you with the UUID, but not correlated to any other identity provider. The usual approach would currently be to use the List Devices Endpoint, and extract the UUID via its identity data, chaining curl->jq->mender-cli for example.

But if you have a neat idea on how to add it to the devices list command…? :grin:


Thanks @TheYoctoJester !

Well if you have a list of thousands of devices, I guess that solution will stop being viable after a while, hehe.

My 2nd option is to make the device itself report the UUID through our own systems and I can take use of it directly.

Thanks again for the info. I will look into if the unix signals can be replaced by windows handlers or something. I was surprised that there was not a platform neutral library for this. Maybe there is in Go?