How to get back the SharePoint WebServices applicaion in IIS if deleted, SharePoint 2010

In SharePoint 2010, if you have deleted or some how removed the Sharepoint Webservice site unknowingly.

its hard to get it back, in spite of running psconfig we would not able to get the SharePoint Webservice back.

It is the same SharePoint webservice application which we see in Sharepoint 2007

Here is is powershell script which can help us to get all the running service back under IIS with their GUID.


$webservice = [System.Type]::GetType("Microsoft.SharePoint.Administration.SPIisWebServiceSettings, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c")



$Instance = $webservice::Default

$Method = $webservice.GetMethod("ProvisionLocal", "Instance, NonPublic", $null, @(), $null)

$Method.Invoke($Instance, $null)

$Method = $webservice.GetMethod("Provision", "Instance, Public", $null, @(), $null)

$Method.Invoke($Instance, $null)

Once we are done with about script we should have “SharePoint Web Service” under IIS with only few information.

now we need to get all the respective VD in IIS.

Get-SPServiceApplication | ForEach-Object {$_.Provision()}


Above steps should helps us to get the missing VD and Sharepoint Webservice back in IIS.

Comments (7)
  1. Anonymous says:

    Thanks! This worked for me in multi-tier SharePoint 2013 farm. Just make sure you create the root folder on all WFEs.

  2. james says:

    Thanks for the above guide, I'm still having the problem that after executing the final

    $Method.Invoke($Instance, $null)

    PowerShell seems to hang showing no activity, allthough the site is created in IIS, it only seems partially there as none of the asp files are present and when exploring the directories, all the content is blank.  Running the Get-SPServiceApplication | ForEach-Object {$_.Provision()} makes no difference either, and again seems to han

  3. in spite of running psconfig we would not able to get the SharePoint Webservice back says:

    sorry for my poor English reading, i think it means although we have run psconfig, it is still not get back.

    and a typo:

    $Method = $werbservice.GetMethod("ProvisionLocal", "Instance, NonPublic", $null, @(), $null)

    should be:

    $Method = $webservice.GetMethod("ProvisionLocal", "Instance, NonPublic", $null, @(), $null)

  4. Craig Mills says:

    I've seen this method posted around the Net a few times, but having suffered the same fate as few others, I too have lost the SharePoint Web Services Application in IIS and have beeen trying to recreate it.

    Unfortunately I cannot get past the $Method.Invoke($Instance, $null) as it throws an error every time I execute it.

    Has their been any updates on this script?

    I have opened up PowerShell and just started typing the commands one by one. Is this the corect way?


  5. vinitvt says:

    Hi Craig,

    Apologize for delayed response.

    I have retested it and it works fine on my machine.

    if you are still facing the issue, could paste the error message here.



  6. chaitanya says:

    Even i have the same issues when i run  cmdlets

    $Method.Invoke($Instance, $null)


    Exception calling "Invoke" with "2" argument(s): "Non-static method requires a target."

    At line:1 char:15

    + $Method.Invoke <<<< ($Instance, $null)

       + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

       + FullyQualifiedErrorId : DotNetMethodException

    Vinit let me know if you have any suggestions  in this,

    Kind Regards,


  7. It throws the same error twice, when the invoke method is called; Exception calling "Invoke" with "2" argument(s): "A configuration file cannot be created for the requested Configuratio n object." At line:1 char:15 + $Method.Invoke <<<< ($Instance, $null)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodTargetInvocation

Comments are closed.

Skip to main content