2

IIS 7.0+ uses a concept of so-called virtual accounts to identify application pools (IIS AppPool\apppoolname). Do those accounts have profiles and can be local environment variables set for them? How?

UserControl
  • 14,766
  • 20
  • 100
  • 187

2 Answers2

1

The very bottom of this blog post says the virtual accounts cant be managed, they just don't appear in user searches within windows so it sounds like its possible:

http://weblogs.asp.net/owscott/managed-service-accounts-msa-and-virtual-accounts

*IIS and Virtual Accounts For IIS and Virtual Accounts, the user is called “IIS AppPool{apppoolname}”. For example, “IIS AppPool\DefaultAppPool”. Note that Virtual Accounts can’t be found with the Windows Select Users or Groups tool, but if you type in the name specifically, it can be managed there.*

Alternatelively, You could create a local user account on the server and set the app pool to run as that account.

With regards to editing Environment variables for another user, this post says you can do it in the registry.

https://serverfault.com/questions/397966/windows-how-to-set-environment-variable-for-another-user

Community
  • 1
  • 1
WraithNath
  • 17,658
  • 10
  • 55
  • 82
  • 1
    Hmm, for some reason there are no SIDs under `HKEY_Users` key in the registry for the pool identities on my machine. Even for standard `IIS AppPool\ASP.NET v4` account. – UserControl May 15 '15 at 10:47
  • Can you add it in there manually? you might be able to configure it using the windows UI if you can 'run as' on the 'Edit environment variables for your account' screen in windows – WraithNath May 15 '15 at 14:37
1

Yes, those accounts have their own profiles and you can set environment variables specifically for each account.

Just use a server-side page to set the variable and you can then use it.

I have a PowerShell script to demonstrate that this works in an answer over on ServerFault.

In the advanced settings for the application pool, make sure that Load User Profile is True but this is the default.

Community
  • 1
  • 1
Peter Hahndorf
  • 10,767
  • 4
  • 42
  • 58
  • @UserControl - You can not set the variables directly on the command line, because you can not run the command prompt as the IISAppPool account. But my PowerShell script does this by calling a web page which you need to have. – Peter Hahndorf May 15 '15 at 11:20