Set-ExecutionPolicy is architecture-specific

I was repeatedly getting “execution of scripts is disabled on this system” while attempting to run Invoke-Command on a remote machine, even after running Set-ExecutionPolicy RemoteSigned on that box.

Eventually the penny dropped – I’d been running 32 bit Powershell interactively, whereas Invoke-Command appeared to be running 64 bit Powershell. The Powershell designers, in their infinite wisdom, made the execution policy separate for the 32 & 64 bit versions. I guess that’s not quite as bad as installing Powershell 3.0 under the directory ‘WindowsPowershell\1.0’.

Re-running Set-ExecutionPolicy RemoteSigned in the 64 bit Powershell console solved the issue.