I came across the below error when trying to create a new web application via PowerShell against a 2013 farm.
“Specified value is not supported for the domainname parameter error when creating web apps”
This appears to have been caused by the machine loosing connectivity to the domain so even though my server was domain joined it was not connected. In my case this was due to the DNS service failing, re-starting the DNS service allowed me to create the web app.