Pester sample script gets "-Be is not a valid Should operator" on Windows 10, works fine on Ubuntu
To expand on the other answer, Windows 10 (and Server 2016) come with Pester version 3.4.0 pre-installed. From version 4 of Pester onward some Pester syntax was changed, including the Should
assertions which are now provided as parameters (e.g Should Be
became Should -Be
).
The documentation reflects the newer syntax, hence why it is misleading for older versions of Pester.
You can install the latest version of Pester on your Windows 10 machine, by running the following with an admin-level PowerShell window:
Install-Module -Name Pester -Force -SkipPublisherCheck
To see what else changed between Pester versions 3 and 4, see here:
The problem turned out to be the wrong version of Pester on the Windows 10 system, as suggested by user2864740.