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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Modifying IIS7 Default Document with Powershell
Posted in Hosting & IIS7, Windows Powershell | No Comment | 8,665 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.



Leave a Reply