/build/static/layout/Breadcrumb_cap_w.png

Adding/removing entry to/from IIS Manager

Hello Folks,

Today i would share with you script to convert a virtual application to web application in IIS manager. This was a bit headache, since i had to try hell lot of things before narrowing down to script. Anyways, following are the two scripts

For Adding entry to IIS

Option Explicit

On Error Resume Next

dim objshell,win, AppCMD, strc

set Objshell=CreateObject("Wscript.Shell")

win = Objshell.ExpandEnvironmentStrings("%WINDIR%")

AppCMD=Win & "\system32\inetsrv\appcmd.exe"   'appcmd converts your virtual apps to web in IIS manager

 

'======================register the app in IIS==============================================

 

strc = chr(34) & appcmd & chr(34) & " add app /site.name:" & chr(34) & "Default Web Site" & chr(34) & " /path:" & chr(34) & "/<Name of the application>" &chr(34) & " /physicalPath:" & chr(34) & "C:\inetpub\wwwroot\<Name of application>" & chr(34)

objshell.Run StrC,0,TRUE

Set ObjShell=Nothing

 

For removing entry from IIS manager

Option Explicit

On Error Resume Next

dim objshell,win, AppCMD, strc

set Objshell=CreateObject("Wscript.Shell")

win = Objshell.ExpandEnvironmentStrings("%WINDIR%")

AppCMD=Win & "\system32\inetsrv\appcmd.exe"

 

'======================remove the app in IIS==============================================

 

strc = chr(34) & appcmd & chr(34) & " delete app /app.name:" & chr(34) & "Default Web Site" & "/<Name of application>" & chr(34)

objshell.Run StrC,0,TRUE

 

Set objshell=Nothing

Hop you guys find it useful. Cheers


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ