Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS7.5 PowerShell preloadEnabled

Is it possible I can use PowerShell command (e,g, New-WebSite) to create a web site and set site's preloadEnabled="true"?

like image 859
hardywang Avatar asked May 23 '12 13:05

hardywang


People also ask

How do I enable application initialization in IIS?

In the left pane of IIS Manager, navigate to the SQL Monitor web site. Right click the application node and select Manage Website > Advanced Settings. Set Preload Enabled to True. Restart IIS by executing iisreset in a command prompt running as an administrator.

What is IIS preload?

Setting preloadEnabled to "true" tells IIS 8.0 that it sends a "fake" request to the application when the associated application pool starts up. That is why in the previous step we set the application pool's startMode to "AlwaysRunning".

What is IIS application initialization?

IIS Application Initialization allows website administrators to configure a web application to be pre-loaded as soon as the worker process starts, before the first request arrives. By pre-loading the application, the worker process is able to reduce the time it takes to respond to the first request.

What is IIS in PowerShell?

If you manage Windows Servers, you've likely worked with Internet Information Services (IIS). Websites are one of IIS's main features and, using PowerShell, you can easily manage and automate IIS with PowerShell IIS scripts! In this article, you'll be introduced to a new way to manage IIS using PowerShell.


2 Answers

This is a bit late, but this will help others... This worked for me and was a little less verbose. The key difference is that I removed ApplicationDefaults because I am setting the application, not the defaults here:

Set-ItemProperty IIS:\Sites\<siteName>\<applicationName> -name preloadEnabled -value True

WHERE: 'SiteName' might equal Default Web Site 'ApplicationName' might equal MyApplication

like image 31
kirkpabk Avatar answered Sep 28 '22 18:09

kirkpabk


This should do the trick. You can use the get-itemproperty to verify that it worked. It took me a while to figure out where to find preloadEnabled within powershell but if you pipe the site path to get-member, then you can work your way from there.

import-module webadministration
set-itemproperty IIS:\Sites\SiteName -name applicationDefaults.preloadEnabled -value True
like image 141
Jake M. Avatar answered Sep 28 '22 18:09

Jake M.