I need a way to expand environment variable on a remote machine.
Suppose I have a path to a folder %appdata%\\MyApp\\Plugins or %ProgramFiles%\\My
The question doesn't make sense. Environment variables are not per-machine variables. For instance, you can expect %appdata% to point inside the C:\users\ directory, but precisely where obviously depends to the user. Logging in as admin still doesn't help you; that would merely tell you where the admin's %appdata% is.