How to set applicationDefaults.preloadEnabled to True on a IIS WebApplication (instead of WebSite) with Powershell?

428 Views Asked by At

I'm including a Powershell script in my WixToolset installer to do various tasks in IIS, and I can't figure out one thing.

My Site in IIS is structured like this:

  • Sites
    • Default Web Site
      • WebApp1
      • WebApp2
      • Identity

I am able to set applicationDefaults.preloadEnabled to true on Default Web Site, but I only want to set preloadEnabled on my Identity WebApplication.

With limited Powershell knowledge, I've tried:

Import-Module WebAdministration
Get-WebApplication 
Get-WebApplication "Identity"

The code above lists the Identity WebApplication correctly.

cd C:\inetpub\wwwroot
Set-ItemProperty "Identity" -Name applicationDefaults.preloadEnabled -Value True

The code above gives the error: The property string applicationDefaults.preloadEnabled=True does not exist or was not found. At line:1 char:1

I've also tried preloadEnabled instead of applicationDefaults.preloadEnabled, same result.

1

There are 1 best solutions below

1
RandyMangar On BEST ANSWER

figured it out thanks to the comment from @guiwhatsthat and some extra searching. This is what worked.

Set-ItemProperty "IIS:\Sites\Default Web Site\Identity" -Name preloadEnabled -Value True