2

I've read this article but it doesn't appear to use the ApplicationPool class described here. Feels like this is something simple I'm missing.

Also, in case anyone feels like being extra helpful, I'm trying to accomplish this in a PowerShell script that can basically take a list of application pool names and set their credentials using a script. I can obviously derive this from a straight C# implementation, however.

Thanks!

Community
  • 1
  • 1
Brandon Linton
  • 4,373
  • 5
  • 42
  • 63
  • tried taking a look and got this far import WebAdministration $appPool = Get-Item '.\AppPools\ASP.NET v4.0' $appPool.processModel.Attributes.Item(1).Value = "domain\test user" $appPool.processModel.Attributes.Item(2).Value = "password" – Iain Sep 30 '10 at 16:01

1 Answers1

6

You have to use the ProcessModel property:

using(ServerManager serverManager = new ServerManager())
{  
    ApplicationPool pool = serverManager.ApplicationPools["YourAppPool"];

    pool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser;  
    pool.ProcessModel.UserName = @"TheUser";  
    pool.ProcessModel.Password = @"ThePassword";  

    serverManager.CommitChanges();  
}
msmolcic
  • 6,407
  • 8
  • 32
  • 56
Carlos Aguilar Mares
  • 13,411
  • 2
  • 39
  • 36