search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Hosting & IIS7, Windows Powershell | 1 Comment | 9,157 views | 16/12/2010 21:45

Powershell function to modify Default Document configuration in IIS7.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Function Modify-DefaultDoc
{
Param ($Description, $DefaultDocName, $Action)
 
    If ($Action -eq "Add")
    {
        Add-WebConfiguration //DefaultDocument/Files -AtIndex 0 -Value @{Value="$DefaultDocName"} -PSPath IIS:\ -Location $Description 
    }
 
    If ($Action -eq "Remove")
    {
        Clear-WebConfiguration //DefaultDocument/Files -PSPath IIS:\ -Location $Description
    }
}

If you want to modify list, just change -AtIndex position.