My Favourite Videos

Wednesday, January 16, 2008

RECYCLING THE APPLICATION POOL

On Error Resume Next
strComputer = InputBox _
("Please enter the name of the Computer where ‘XXXXX’ to be Recycled:", _
"Enter ComputerName Name")

if strComputer = "" Then
Wscript.Quit
End If
strUser = InputBox _
("Please enter the UserName:", "Enter UserName")
strPassword = InputBox _
("Please enter the Password:", "Enter Password")
PoolName = InputBox ("Please Enter the Name of the Application Pool :", "Application Pool Name")
Set LocatorObj = CreateObject("WBemScripting.SWbemLocator")
LocatorObj.Security_.ImpersonationLevel = 3
LocatorObj.Security_.AuthenticationLevel = 6
Set ProviderObj = LocatorObj.ConnectServer(strComputer, "\root\microsoftiisv2", strUser, strPassword)

Set colItems = ProviderObj.ExecQuery _
("Select * From IIsApplicationPool Where Name = " & _
"'W3SVC/AppPools/Enter the Application Pool Name'")
For Each objItem in colItems
objItem.Recycle
On Error Goto 0
WScript.Echo "The Application Pool in " & strComputer & " is Recycled"
Next

No comments: