Tuesday, May 5, 2015

Add Pingdom Probe Server IPs to IIS using PowerShell

I'm by no means a PowerShell script person.  It's pretty useful though, so after an hour or so along with a bunch of internet searches, I came up with a script to add the list of Pingdom Probe servers to my IIS allow list.

This script will parse the list of Pingdom probe servers (https://support.pingdom.com/Knowledgebase/Article/View/61/0/probe-servers) and add the given IPs to the IP Restriction Allow list for an IIS application.


$applicationPath = "Default Web Site/ApplicationName"

$doc = [xml](Invoke-WebRequest -URI "https://www.pingdom.com/rss/probe_servers.xml")
$ns = New-Object Xml.XmlNamespaceManager $doc.NameTable
$ns.AddNamespace("pingdom", "http://www.pingdom.com/ns/PingdomRSSNamespace")
$nodes = $doc.SelectNodes("/rss/channel/item/pingdom:ip", $ns)

$currentIPList = Get-WebConfiguration system.webServer/security/ipSecurity -Location $applicationPath -PSPath IIS:\

foreach($ip in $nodes)
{
    $exists = $currentIPList.Collection | where { $_.ipAddress -eq $ip.'#text' }

    if (!$exists)
    {
        $configEntry = @{allowed="true"; ipAddress=$ip.'#text'}
        Add-WebConfiguration  system.webServer/security/ipSecurity -Location $applicationPath -Value $configEntry -PSPath IIS:\
        "Added: " + $ip.'#text'
    }
}

2 comments:

john

We Provide Our Customers With Latest and up-to-date Dumps Questions & Answers with 100% Exam Passing Guarantee. We Promise Exceptional Success in First Attempt.
700-265 exam questions answers

Joanna Smith

As we likely mindful BCS is one the best name in the business. A huge segment of the understudies pick BCS Certification to prepare their calling. There are a huge amount of locales that gives you BCS Certification test Questions Answers, But Exams4sure is above from all and have a genuine BCS Certification Exam Questions. ISEB-PM1 is the latest affirmation Exam of BCS. Exams4sure gives you ISEB-PM1 Exam Test Questions Answers and ISEB-PM1 PDF Test Engine. Exams4sure consider control positions are 100% attested and genuine. Exams4usre is known for it's quality. Get your ISEB-PM1 Braindumps PDF record today.

ISEB-PM1 Dumps