Viewing/Changing a Particular App Pool

skunkx1

New member
Joined
Aug 4, 2005
Messages
4
Programming Experience
Beginner
Hey Everybody,
This is my first post ever:
I am trying to write a program that gets a list of application pools, and then you are able to view the current Identity(Username and Password), and then change it. The current code i have to view it only seems to get the identity of the default pool, or even the App Pool folder. This code reads:
VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] myConnectionOptions [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] ConnectionOptions[/size]
[size=2][size=2][color=#0000ff]With[/color][/size][size=2] myConnectionOptions[/size]
[size=2][size=2].Impersonation = ImpersonationLevel.Impersonate
.Authentication = AuthenticationLevel.Packet
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]With[/color][/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] myManagementScope [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementScope[/size]
[size=2]myManagementScope = [/size][size=2][color=#0000ff]New[/color][/size][size=2] ManagementScope("\\" & "(Server)" & "\root\microsoftiisv2", myConnectionOptions)[/size]
[size=2]myManagementScope.Connect()
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].lstAppPool.Items.Clear()[/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] mySearcher [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] ManagementObjectSearcher(myManagementScope, [/size][size=2][color=#0000ff]New[/color][/size][size=2] SelectQuery("Select * from IIsApplicationPoolsSetting"))[/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] objectItems [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementObjectCollection = mySearcher.Get()[/size]
[size=2][color=#0000ff]Dim[/color][/size][size=2] objectItem [/size][size=2][color=#0000ff]As[/color][/size][size=2] ManagementObject[/size]
[size=2][color=#0000ff]For[/color][/size][size=2][color=#0000ff]Each[/color][/size][size=2] objectItem [/size][size=2][color=#0000ff]In[/color][/size][size=2] objectItems[/size]
[size=2]lstAppPool.Items.Add(objectItem.Item("WAMUserName"))
lstAppPool.Items.Add(objectItem.Item("WAMUserPass"))
[/size][size=2][color=#0000ff]Next[/color][/size]
[color=#0000ff]
[/color]
[/size][/size]Please help me to get all the app pools, specify a certain app pool, or even modify a certain app pool.

thanks
 
Last edited by a moderator:
Back
Top