To set an AppPool to run under a different user, in poqwershell :
Set-ItemProperty IIS:\AppPools\MyAppPool -name processModel.identityType -value X
Where X =
0 = LocalSystem
1 = LocalService
2 = NetworkService
3 = SpecificUser
4 = ApplicationPoolIdentity
http://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
Just a blog about ITSM. IT Systems Managment. Dragging together a collection of useful scripts and snippets. Some are mine, others 'borrowed' from other sources.
Showing posts with label AppPool. Show all posts
Showing posts with label AppPool. Show all posts
Sunday, 7 February 2016
List all IIS Web Applications with the .net version, the state of the Web Application and the assigned user/identity.
List all IIS Web Applications with the .net version, the state of the Web Application and the assigned user/identity.
try{
Import-Module WebAdministration
Get-WebApplication
$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}
$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password
$obj = New-Object PSObject -Property $item
$list += $obj
}
$list | Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password"
}catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}
From : https://melcher.it/2013/03/powershell-list-all-iis-webapplications-net-version-state-identity/
try{
Import-Module WebAdministration
Get-WebApplication
$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}
$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password
$obj = New-Object PSObject -Property $item
$list += $obj
}
$list | Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password"
}catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}
the output is a table:
| WebAppName | Version | State | UserIdentityType | Username | Password |
| Web123 | v2.0 | Started | SpecificUser | test\webuser | P@55w04D |
From : https://melcher.it/2013/03/powershell-list-all-iis-webapplications-net-version-state-identity/
Subscribe to:
Posts (Atom)