How can I remove a virtual directory in the Default Web Site using appcmd.exe?
This is an old question which I just had to solve and I thought it would be helpful to post the correct answer since both answers here didnt really work though they are close
This was on Windows server 2008 R2 IIS 7.5 and i did use Run as administrator to open the cmd window
cd %systemroot%\system32\inetsrv
To get list of virtual directory entries
appcmd list app
This will come up with a list of apps like so
APP "Default Web Site/" (applicationPool:DefaultAppPool)
APP "Default Web Site/VirtualDir/auth" (applicationPool:DefaultAppPool)
Remove Virtual Directory called VirtualDir
appcmd delete app /app.name:"Default Web Site"/VirtualDir/auth
Its a very odd format having to enclose Default Web Site in quotes but enclosing the entire string will fail
I used this to delete four Virtual folders that had already been deleted through IIS GUI but they left orphaned directories preventing reinstallation under the same name
Hope this helps someone else
Though the poster is likely long since solved this or given up, to solve thier particular case would be
appcmd delete app /app.name:"Default Web Site"/LeadsManagementServiceUAT/Services/
neeraj
Updated on June 05, 2022Comments
-
neeraj about 2 years
i have a virtual directory in my Default web Site , i delete this from iis list , but it is still shows in when i run
appcmd list vdir
it shows like this :
VDIR "Default Web Site/LeadsManagementServiceUAT/Services/" (physicalPath:D:\NewExternalLMS\Main-branchLMSSLF\External_LMS)
i tried following command to delete it
appcmd DELETE vdir /vdir.name: "Default Web Site/LeadsManagementServiceUAT/Services/"
but it shows
Failed to process input: The parameter 'Web' must begin with a / or - (HRESULT=8 0070057).
how do i correctly write the website name.I followed like this :
it says use like this :
appcmd delete app /app.name:"Default Web Site"/VDir
it is not working either ,.Please suggest