Security doesn't allow developers to have IIS installed locally on their PCs, nor do they allow developers to be in the administrator group of the development web server. In order for them to debug, we have individual application pools running under the identity of the developer. (Thankfully IIS 6.0 has allowed this feature.) We wrote a small program that allows a user to recycle their application pool:
public void RecycleAppPool(string appPoolLocation, string appPoolName)
{
//Execute Code to recycle a user's app pool
DirectoryEntry w3svc = new DirectoryEntry(appPoolLocation + appPoolName);
w3svc.Invoke("Recycle", null);
}
What I would also like to do is allow them to change their application pool's identity password when it changes every 90 days. How would I do this programmatically

Change Application Pool Identity Programmatically
Ryan B
You might have a application pool looks like:
IIS://Localhost/W3SVC/AppPools/myAppPoolSample
metabasepath: IIS://Localhost/W3SVC/AppPools
AppPoolName: myAppPoolSample
AppPoolUser: <your specified user>
AppPoolPass: <your specified user's passwd>
Sorry that I didn't explain those parameters clearly.
Wang Chi
Mikhail Arkhipov
string appPoolName = "hr90117";
string appPoolUser = "hr90117";
string appPoolPass = "test";
DirectoryEntry myAppPool;
new DirectoryEntry(metabasePath);DirectoryEntry apppools =
myAppPool = apppools.Children.Find(appPoolName, "IIsApplicationPool");
myAppPool.Invoke("AppPoolIdentityType", new Object[] { 3 });
myAppPool.Invoke("WAMUserName", new Object[] { Environment.MachineName + @"\" + appPoolUser });
myAppPool.Invoke("WAMUserPass", new Object[] { appPoolPass });
myAppPool.Invoke("SetInfo", null);
myAppPool.CommitChanges();
Kishore79
Tom2
<IIsApplicationPool Location="/LM/W3SVC/AppPools/Jason" AppPoolAutoStart="TRUE" AppPoolIdentityType="3" CPUAction="1" CPULimit="0" CPUResetInterval="2" PeriodicRestartMemory="0" PeriodicRestartPrivateMemory="0" PeriodicRestartRequests="0" RapidFailProtection="TRUE" WAMUserName="use1\Jason" WAMUserPass="************" />
Would I just use "Jason" as my appPoolName and "IIS://localhost/W3SVC/AppPools" as my metabasePath
Zoltan Magyar
/*modify metabasePath, appPoolName, appPoolUser and appPoolPass */ DirectoryEntry newpool; DirectoryEntry apppools = new DirectoryEntry(metabasePath);
newpool = apppools.Children.Add(appPoolName,
"IIsApplicationPool");newpool.InvokeSet(
"AppPoolIdentityType", new Object[] { 3 });newpool.InvokeSet(
"WAMUserName", new Object[] { Environment.MachineName + @"\" + appPoolUser });newpool.InvokeSet(
"WAMUserPass", new Object[] { appPoolPass });newpool.Invoke(
"SetInfo", null);jimg43
NickP
http://msdn.microsoft.com/library/default.asp url=/library/en-us/iissdk/html/3f84ca0f-5033-4e79-b7e7-3fd48b105657.asp
RickSolie
Snarf99
myAppPool.Properties["WAMUserPass"][0] = appPoolPass;
sramshaw