Here's another 'gotcha' I ran into that I thought I would document to save others from pulling their hair out.
Be aware that the default version of PowerShell in Windows 7 is v2... and thus has no support for many cmdlets available in either PowerShell v3, v4 or v5.
For example, it took me ages to work out why the following 'Unblocker' script worked perfectly well in Windows 10 but didn't work at all in Windows 7:
SpoilerThe answer turned out to be that the default version of PowerShell built-in to Windows 7, i.e. v2.0, doesn't support
Get-ChildItem -Path '%SourceVar%' -Recurse | Unblock-File. Eventually I found out that I needed to install PowerShell v3 for it to work.
So... if your PowerShell code wrapped in AHK doesn't work, consider building in a check for the version of PowerShell on the target device.
Hope this helps...