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'
    }
}

6 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

Anonymous

A debt of gratitude is in order for offering pleasant data to us. i like your post and all you impart to us is uptodate and entirely useful, i might want to bookmark the page so i can come here again to peruse you, as you have made a superb showing. my ip location

Elegant IT Services

Thanks for sharing Useful Information with us...
Best Training Institution for IT and Non-IT Courses in Bangalore

รวมสล็อตสุดฮิต

เว็บ สล็อต แตก ง่าย ที่สุด เกมพนันออนไลน์ยอดนิยมยอดนิยมสูงที่สุดในตอนนี้เนื่องมาจากเป็นเกมทีมีแบบอย่างการเล่นที่ง่ายแตกง่าย pg slot ลงเงินแค่นิดเดียวก็ทำคุณให้สล็อตแตกได้

ninja slot

โหลดสล็อตxo เเอปพลิเคชันเกมสล็อต ลงบนโทรศัพท์มือถือ โหลดฟรีไม่ต้องเสียเงิน pgslot รองรับทุกระบบการใช้แรงงานจัดตั้งง่าย ได้ทั้งยัง iOS,Android สบาย รวดเร็วทันใจสบายหายห่วง