Logged into a server using Microsoft Remote Desktop, opened a CMD box and typed "set", resulting in:

CLIENTNAME=macbook-pro-102  // <-- My Macbook which I'm sitting typing at
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=WIN-U1A1A72NOU3   // <-- The remote computer's name
So Dave's solution looks good to me for that environment at least.