Managing IIS from powershell
29 Aug 2017
iis powershellManaging IIS from powershell
Start aspnet_state service
get-service | Where {$_.Name -eq 'aspnet_state'}
get-service | Where {$_.Name -eq 'aspnet_state'} | Start-Service
start-service aspnet_state
Set custom app pool identity
get-module
get-module -ListAvailable
import-module webadministration
import-module iisadministration
$appPool= get-iisapppool DefaultAppPool
$appPool.ProcessModel.IdentityType
$appPool.ProcessModel.UserName = "domain\username"
$appPool.ProcessModel.Password = ""
$appPool.ProcessModel.IdentityType = 3 # or $appPool.ProcessModel.IdentityType = "SpecificUser"
Getting configuration information about a module docs
IIS:\> Get-WebGlobalModule -Name "UriCacheModule"
Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.