After trying countless things, including reinstalling PowerShell, I found the problem and the solution.
The folder c:\windows\system32\powershell was missing from my computer. Reinstalling PowerShell didn't restore it. To fix it, simply run: Install-PowerShellRemoting.
From that moment on, everything worked as it should.