The code in question uses single quotes (') where double quotes are needed ("). When single quotes are used in PowerShell variables aren't expanded. http://windowsitpro.com/blog/single-quotes-vs-double-quotes-powershell-whats-difference
This means '.ssh$File' quite literally means '.ssh$File' and not '.ssh\id_rsa' (or what ever value is specified in $File) as was obviously expected.
Sigh, rookie mistake. Thanks for the report.