Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have sucessfully removed my Web Application with the following script:

PS C:\Users\SP2013Farm> Remove-SPWebApplication http://portal.com -Confirm -Dele
teIISSite -RemoveContentDatabases

Confirm
Are you sure you want to perform this action?
Performing operation "Remove-SPWebApplication" on Target "portal.com".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y
Remove-SPWebApplication : This operation uses the SharePoint Administration ser
vice (spadminV4), which could not be contacted.  If the service is stopped or d
isabled, start it and try the operation again.
At line:1 char:1
+ Remove-SPWebApplication http://portal.com -Confirm -DeleteIISSite -RemoveCont
ent ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...PWebApplication:
   SPCmdletRemoveSPWebApplication) [Remove-SPWebApplication], InvalidOperatio
  nException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletRemoveSP
   WebApplication

But as you can see from the result, it failed. I checked if the service was running, and to my surprise it was. So I tried to change the user who is running the service (Log On As) SPAdminV4 to the Farm administrator instead. And that worked:

PS C:\Users\SP2013Farm> Remove-SPWebApplication http://portal.com -Confirm -Dele
teIISSite -RemoveContentDatabases

Confirm
Are you sure you want to perform this action?
Performing operation "Remove-SPWebApplication" on Target "portal.com".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y
PS C:\Users\SP2013Farm>
  • Question is why it didn't work logged on as Local System?
  • Can I leave the service SPAdminV4 Log On As Farm Administrator or should I switch back to Local System?
share|improve this question

1 Answer 1

up vote 1 down vote accepted

Make sure that:

  1. You did "run as an admin" on the SharePoint Management Shell.
  2. The account with which you tried the first time is actually a Farm Administrator
  3. The account with which you tried the first time has "SPShell" Admin rights. This will allow him to do operations with the SharePoint Management Shell. He doesn't get them by default even when in local admin. Use this command:

    Add-SPShellAdmin -UserName CONTOSO\User1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.