Is it possible I can use PowerShell command (e,g, New-WebSite) to create a web site and set site’s preloadEnabled=”true”?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve been looking for this too, but couldn’t find anything in WebAdministration to set this option. Presumably the approach would be to call New-ItemProperty on the correct WebApplication. Unfortunately, I was unable to get the “default” application for a given website, or to set this property on it. It kinda seems like the WebAdministration module (which enables cmdlets like New-WebSite) was written with earlier versions of IIS in mind, and certainly before the Application Initialization module.
This is a workaround, which forces the setting of these properties by editing the underlying applicationHost.config file. This is a slightly simplified version of a script we’re now using. You’ll need to run this script as an administrator.