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 | 1 Comment | 9,155 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.


Comments (1)

shwetamber

May 28th, 2020
19:07:16

How to remove one document from list atIndex 1 ?



Leave a Reply