# IIS and BranchCache Setup & Config

### Windows Component setup, IIS & BranchCache.  From elevated PowerShell:

```powershell
Add-WindowsFeature Web-Server, Web-Http-Errors, Web-Static-Content, Web-Digest-Auth, Web-Windows-Auth, Web-Mgmt-Console, BranchCache 
```

### IIS MIME Types

There are several additional MIME types that need to be added to the default list that IIS creates for you to be able to iPXE boot devices for OSD processes.  Below is a script to populate those on the IIS Server:

```powershell
#Set the MIME types for the iPXE boot files, fonts etc. 

function Set-IISMIMETypes {
    # Set the MIME Types for the iPXE boot files, fonts, etc.
    # v2.0 - accounts for duplicates (e.g. BIN, TTF, WIM)
    
    $mimeTypeList = @(
    @(".",     "application/octet-stream"), # BCD file (with no extension)
    @(".bcd",  "application/octet-stream"), # boot.bcd boot configuration files
    @(".bin",  "application/octet-stream"), # wimboot.bin file
    @(".com",  "application/octet-stream"), # BIOS boot loaders
    @(".efi",  "application/octet-stream"), # EFI loader files
    @(".img",  "application/octet-stream"), # .img file type
    @(".ipxe", "text/plain"),               # .ipxe file
    @(".iso",  "application/octet-stream"), # .iso file type
    @(".kpxe", "application/octet-stream"), # For the UNDIonly version of iPXE
    @(".n12",  "application/octet-stream"), # BIOS loaders without F12 key press
    @(".pxe",  "application/octet-stream"), # For the iPXE BIOS loader files
    @(".sdi",  "application/octet-stream"), # For the boot.sdi file
    @(".ttf",  "application/octet-stream"), # For the boot fonts
    @(".wim",  "application/octet-stream")  # For the winpe images itself
    )
    
    foreach($mimeType in $mimeTypeList)
    {
        #$mimeType[0] - extension; $mimeType[1] - mimeType
        if((Get-WebConfigurationProperty -Filter "system.webServer/staticContent" -Name "Collection").Where({$_.fileExtension -eq $mimeType[0]}).Count)
        {
            # Update the existing setting without destroying everything else :)
            Set-WebConfigurationProperty -Filter "system.webServer/staticContent/mimeMap[@fileExtension='$($mimeType[0])']" -Name "mimeType" -Value $mimeType[1]
        } 
        else 
        {
            # Add a new setting
            Add-WebConfigurationProperty //staticContent -name collection -value @{fileExtension=$mimeType[0];mimeType=$mimeType[1]}
        }
    }
}
#Run the Function
Set-IISMIMETypes

```

To confirm in IIS Manager, open IIS, Click "Default Web Site" and Double Click on MIME Types to get the list. Confirm the ones above are added.

<figure><img src="/files/Shl2f0FFzXz3k52n9iSV" alt=""><figcaption></figcaption></figure>

### IIS Virtual Directory

A virtual directory in IIS to point at the Remote Install Folder is needed.  This can be done manually in IIS Manager, or via PowerShell.  This command will create the virtual directory based on the default installation path of iPXE Anywhere Web Service:

```powershell
New-WebVirtualDirectory -Site "Default Web Site" -Name "Remoteinstall" -PhysicalPath 'C:\ProgramData\2Pint Software\2PXE\Remoteinstall\'
```

To do this manually via the IIS Manager:

* Open IIS, Right Click on "Default Web Site" and choose "Add Virtual Directory..."
* Alias: Remoteinstall
* PhysicalPath = C:\ProgramData\2Pint Software\2PXE\Remoteinstall

Once you have added it, it will show up in the console, and if you drill down you'll see the extra subfolders, and if you check the Advanced Properties, you can confirm the path

<figure><img src="/files/CkF0gzYM6oDViRqOMhl8" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.2pintsoftware.com/2pxe-server/configuration/iis-and-branchcache-setup-and-config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
