Thanks to @Softavi.
The problem is solved by adding the flag ‘-AllowCommandletRendering’ to the command line.