Hi Mike,
I was exactly in the same situation as you and looking for a simple answer.
It has started with customer’s enquiry to obtain serial number in CODESYS project.
Unfortunately library “SysTarget”, even though equipped with function SysTargetGetSerialNumber, returns a MAC address instead of serial number.
One solution is to use library WAGOAppConfigTool:
And add a fb call in your program:
@WagoDamRud has described it further in this post: SSH command from CoDeSys - CODESYS - WAGO Open Source Community.
Hope this helps!
Marcin