The problem is with the last line. Whilst the –RemoveLicence line will not throw an error, it actually only works if you specify explicitly which Licence you want to remove.
For example you may have the following licensed items installed:
To resolve the issue, please right click the 32Bit PowerShell icon and select "Use as administrator" and enter the following example command to remove a particular license: