New-SPWebApplication ApplicationPoolAccount is not found error while creating SharePoint 2016 web application using PowerShell

Recently I was trying to create a web application using PowerShell in SharePoint 2016. The error comes as New-SPWebApplication ApplicationPoolAccount is not found. You can write, execute, and debug the PowerShell script using Windows PowerShell ISE.

I was using the below PowerShell script:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "Sharepoint2016" -ApplicationPoolAccount (Get-SPManagedAccount "mama") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

And the error will come like below:

New-SPWebApplication ApplicationPoolAccount is not found

New-SPWebApplication ApplicationPoolAccount is not found
New-SPWebApplication ApplicationPoolAccount is not found

New-SPWebApplication ApplicationPoolAccount is not found

Here two things I have changed, one is we need to provide a domain account instead of the only username. I was using the account name as “mama”, so I modified to “domain name\user name” like “TSINFO\mama”.

The other point we need to check is that there should not be any line break in the New-SPWebApplication cmdlets. I have modified the cmdlet to like below and it successfully created the web application.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "Sharepoint2016" -ApplicationPoolAccount (Get-SPManagedAccount "TSINFO\mama") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

Read some PowerShell tutorials:

I hope this tutorial helps to fix error New-SPWebApplication ApplicationPoolAccount is not found.

>