New-SPWebApplication application pool account is not found
Asked Answered
S

2

7

I am trying to create a new web application using PowerShell. I keep getting the error application pool account is not found! How do I solve this?

I tried adding the new web application to DefaultAppPool as follows:

New-SPWebApplication -Name "Test WebApp" -ApplicationPool "DefaultAppPool" -ApplicationPoolAccount (Get-SPManagedAccount "WIN2K8R2SPTEST\Administrator")

But the Cmdlet Get-SPManagedAccount seems to return an empty string. I also tried to change the ApplicationPool to SharePoint 80.

I am running SharePoint Foundation 2010 on a standalone installation. How can I fix this error?

Streptomycin answered 7/6, 2012 at 12:42 Comment(1)
Did you make sure you're running this command in elevated Management Shell?Following
F
9

You must create a managed account first for your win2k8r2sptest\administrator. Here is the sequence of steps

$cred = get-credential 'win2k8r2sptest\administrator' // enter the password here
$adminMA = New-SPManagedAccount -Credential $cred
New-SPWebApplication -Name 'Test Webapp' -ApplicationPool "DefaultAppPool" -ApplicationPoolAccount $adminMA

I've tested this on vanilla SPS2010 SP1. I think the process is identical to Foundation as well.

Following answered 8/6, 2012 at 3:32 Comment(1)
thanks, after adding the managed account.. things worked smoothly :)Streptomycin
B
0

In my case I already have the script as posted above by @romanrozinov. But it still didn't work. I realized I have to create a user account in the AD users. Steps can be followed here - http://www.mustbegeek.com/create-user-account-in-windows-server-2008-r2/

I'm an absolute beginner with Sharepoint, adding a user and then running below script fixed the issue:

 $cred = get-credential //enter user name and password
$devAccount = New-SPManagedAccount -Credential $cred
New-SPWebApplication -Name 'Test Webapp' -ApplicationPool "DefaultAppPool" -
ApplicationPoolAccount $devAccount
Bairn answered 29/5, 2019 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.