Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Delete IIS Site and Application Pool script

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,47627
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Delete IIS Site and Application Pool script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Delete IIS Site and Application Pool script - 5/27/2007 12:28:05 PM   
  itdudeinmissouri

 

Posts: 9
Score: 0
Joined: 5/25/2007
Status: offline
Newbie script that will delete an IIS site and the associated application pool which is the IIS site name with an appended _pool, example:
IIS site = web1
Application Pool = web1_pool
an input box will ask for the IIS Site name, the script will delete the site and append the _pool to input variable of the portion of the script that deletes the application pool.
Thanks a ton to dm_4ever for helping me with the code on this, I am a newbie to coding and he helped out greatly!

********************code*********************
'setting variables
Dim objShell, strSite, strInput
Set objShell = CreateObject("WScript.Shell")
Do
'user input box that will ask for IIS site and application pool to delete
strSite = (InputBox(" Site Pool to Delete", "Site Name"))
If strSite <> "" Then
     strInput = True
End If
Loop Until strInput = True
'run the iisweb vbs administration script (create,delete for IIS)
objShell.Run "%comspec% /k C: & iisweb /delete " & strSite
'pause script momentarily to allow for completion of the IIS delete
WScript.Sleep 1000
' for the application pool it will use the above user input and append _pool to variable to
' delete the application pool
strAppPool = strSite & "_pool"
Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
Set objAppPool = objAppPools.delete(strSite & "_pool", strAppPool)
objAppPool.SetInfo
********************code*********************

_____________________________

Spencer
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Delete IIS Site and Application Pool script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts