| |
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
|
|