diff --git a/iis/configuration/system.webServer/security/ipSecurity/add.md b/iis/configuration/system.webServer/security/ipSecurity/add.md index 486705303..645f316c9 100644 --- a/iis/configuration/system.webServer/security/ipSecurity/add.md +++ b/iis/configuration/system.webServer/security/ipSecurity/add.md @@ -179,3 +179,7 @@ The following code samples add two IP restrictions to the Default Web Site; the ### VBScript [!code-vb[Main](add/samples/sample6.vb)] + +### PowerShell + +[!code-powershell[Main](add/samples/sample7.ps1)] diff --git a/iis/configuration/system.webServer/security/ipSecurity/add/samples/sample7.ps1 b/iis/configuration/system.webServer/security/ipSecurity/add/samples/sample7.ps1 new file mode 100644 index 000000000..477dc47ca --- /dev/null +++ b/iis/configuration/system.webServer/security/ipSecurity/add/samples/sample7.ps1 @@ -0,0 +1,7 @@ +Start-IISCommitDelay + +$iisIpSecurity = Get-IISConfigSection -CommitPath 'Default Web Site' -SectionPath 'system.webServer/security/ipSecurity' | Get-IISConfigCollection +New-IISConfigCollectionElement -ConfigCollection $iisIpSecurity -ConfigAttribute @{ 'ipAddress' = '192.168.100.1'; 'allowed' = $false } +New-IISConfigCollectionElement -ConfigCollection $iisIpSecurity -ConfigAttribute @{ 'ipAddress' = '169.254.0.0'; 'subnetMask' = '255.255.0.0'; 'allowed' = $false } + +Stop-IISCommitDelay diff --git a/iis/configuration/system.webServer/security/ipSecurity/index.md b/iis/configuration/system.webServer/security/ipSecurity/index.md index 13e37d9ad..87ea2d62c 100644 --- a/iis/configuration/system.webServer/security/ipSecurity/index.md +++ b/iis/configuration/system.webServer/security/ipSecurity/index.md @@ -187,3 +187,7 @@ The following code samples enble reverse DNS lookups for the default web site. ### VBScript [!code-vb[Main](index/samples/sample7.vb)] + +### PowerShell + +[!code-powershell[Main](index/samples/sample8.ps1)] diff --git a/iis/configuration/system.webServer/security/ipSecurity/index/samples/sample8.ps1 b/iis/configuration/system.webServer/security/ipSecurity/index/samples/sample8.ps1 new file mode 100644 index 000000000..cb73920c8 --- /dev/null +++ b/iis/configuration/system.webServer/security/ipSecurity/index/samples/sample8.ps1 @@ -0,0 +1,3 @@ +$iisIpSecurity = Get-IISConfigSection -CommitPath 'Default Web Site' -SectionPath 'system.webServer/security/ipSecurity' + +Set-IISConfigAttributeValue -ConfigElement $iisIpSecurity -AttributeName 'enableReverseDns' -AttributeValue $true