I have a scenario where I need to construct a powershell path as $RemotePath = \'$($env:USERPROFILE)\\Desktop\\Shell.lnk\'. This variable gets passed to a remot
$RemotePath = \'$($env:USERPROFILE)\\Desktop\\Shell.lnk\'
Expand the string on the remote side:
$ExecutionContext.InvokeCommand.ExpandString($RemotePath)
By using a double quotes. PowerShell won't expand variables inside single-quoted strings.