<#.NOTESAuthor: Will Steele (wlsteele@gmail.com)Last Editted Date: 05/23/2012.EXAMPLESet-IISProcessModelLoadUserProfileBool 1This example demonstrates how to set the global LoadUserProfile value to $true..EXAMPLESet-IISProcessModelLoadUserProfileBool 0This example demonstrates how to set the global LoadUserProfile value to $false.#>function Set-IISProcessModelLoadUserProfileBool{param([Parameter(Mandatory = $false)][Bool]$Bool = $true)$LoadUserProfile = (Get-WebConfigurationProperty -Filter /system.applicationHost/ApplicationPools/ApplicationPoolDefaults[1]/processmodel[1] -Name loaduserprofile -PSPath "Machine/Webroot/apphost").value;if($LoadUserProfile -eq $Bool){Write-Output "$(Get-Date): LoadUserProfile is already set to $Bool.";}else{Write-Output "$(Get-Date): Attempting to set LoadUserProfile to $Bool.";Set-WebConfigurationProperty -Filter /system.applicationHost/ApplicationPools/ApplicationPoolDefaults[1]/processmodel[1] -Name loaduserprofile -Value $Bool -PSPath "Machine/Webroot/apphost";if((Get-WebConfigurationProperty -Filter /system.applicationHost/ApplicationPools/ApplicationPoolDefaults[1]/processmodel[1] -Name loaduserprofile -PSPath "Machine/Webroot/apphost").value -eq $Bool){Write-Output "$(Get-Date): Updated succeeded.";}else{throw "$(Get-Date): Update failed."}}}
PowerShell v2 Function Set IISProcessModelLoadUserProfileBool
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment