Removing a machine from domain using PowerShell
Solution 1:
As per documentation, the parameter -UnjoinDomainCredential
requires a PSCredential object; you can't simply type the credentials in the command line.
You can find more info about how to build a PSCredential object here.