Re-creating the SharePoint Web Services Site

How to restore the SharePoint Web Services IIS Web Site if accidently deleted

The above blog post explains that it is possible to, erroneously, remove the SharePoint Services website from the file system when there are extended zones in play for a web application where the extended zone was created using the option of ‘Use an existing IIS web Site’.

The problem becomes, if the Site that the SharePoint Web Services uses is allowed to be used for a new extension off of an existing web application, and, that extended zone is at some later point deleted, the IIS site (SharePoint Web Services) root folder on the is also deleted.  This action of removing the extended zone, removes the site in IIS as it has already removed the file system root folders.

 

Here are the locations of the root folders for the various levels of SharePoint

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\        – SharePoint 2010

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\WebServices\        – SharePoint 2013

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\WebServices\        – SharePoint 20160

Running this from an administrative, SharePoint Management Shell has fixed the issue of the SharePoint Web Services site having been deleted.

Once you have ran the above script, we should have “SharePoint Web Service” under IIS with only few information.
now we need to get all the respective VD in IIS.

This code should provision all of the service application endpoints, and it needs to be ran after running the above code:

CODE CREDIT: https://blogs.technet.microsoft.com/vinitt/2011/05/13/how-to-get-back-the-sharepoint-webservices-applicaion-in-iis-if-deleted-sharepoint-2010/

Option 2

Run this code: