Public/Get-P2000City.ps1
# .SYNOPSIS # Retrieves P2000 cities in a given emergency services region function Get-P2000City { param ( [Parameter(Mandatory, Position = 0)] [string]$Region ) Get-P2000Region | Where-Object ID -EQ $Region | ForEach-Object { ConvertTo-HtmlDocument -Uri $_.Link | Select-HtmlNode -CssSelector '#filter li a' -All | ForEach-Object { $Properties = [Ordered]@{} $Properties.Region = $Region $Properties.ID = ($_.Attributes['href'].Value -replace '^https?://www.alarmfase1.nl/[^\/]*/', '') -replace '/$', '' $Properties.Name = $_.InnerText $Properties.Link = $_.Attributes['href'].Value $Properties.PSTypeName = 'UncommonSense.P2000.City' [pscustomobject]$Properties } } } |