PS C:\> Get-Help Add-Computer -Online
PS C:\> Get-Help Add-* |% {$_.relatedLinks.navigationLink} |? {$_.uri}
linkText uri
-------- ---
Online version: http://go.microsoft.com/fwlink/?LinkID=113279
Online version: http://go.microsoft.com/fwlink/?LinkID=113281
Online version: http://go.microsoft.com/fwlink/?LinkID=113280
Online version: http://go.microsoft.com/fwlink/?LinkID=135195
Online version: http://go.microsoft.com/fwlink/?LinkID=113278
Online version: http://go.microsoft.com/fwlink/?LinkID=135194
PS C:\> ... | Get-WebPage |% {$_ -match "</p>Updated:\s(?<date>.*?)</p>" | Out-Null ; $Matches.date }
May 20, 2009
October 21, 2009
October 21, 2009
February 17, 2010
February 17, 2010
February 17, 2010
February 17, 2010
February 17, 2010
function Get-WebPage {
[Cmdletbinding()]
param (
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
HelpMessage="Enter URL to download")]
[string]
$Uri
)
BEGIN {
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebProxy]::GetDefaultProxy()
$proxy.UseDefaultCredentials = $true
$wc.proxy = $proxy
}
PROCESS {
$wc.DownloadString($Uri)
}
END { }
}
filter New-TempObj {
$hash = @{
name = $($_.Name)
uri = $($_.relatedLinks.navigationLink |? {$_.linkText -eq 'Online version:'}).uri
}
[datetime]$hash.date = Get-WebPage $hash.uri |% {$_ -match "<p>Updated:\s(?<date>.*?)</p>" | Out-Null; $Matches.date}
$myObj = New-Object PSObject -Property $hash
$myObj
}
Now I am able to do following:
PS C:\> Get-Help Add-* | New-TempObj | ft -AutoSize
date name uri
---- ---- ---
20.5.2009 0:00:00 Add-History http://go.microsoft.com/fwlink/?LinkID=113279
20.5.2009 0:00:00 Add-PSSnapin http://go.microsoft.com/fwlink/?LinkID=113281
16.12.2009 0:00:00 Add-Member http://go.microsoft.com/fwlink/?LinkID=113280
20.5.2009 0:00:00 Add-Type http://go.microsoft.com/fwlink/?LinkID=135195
20.5.2009 0:00:00 Add-Content http://go.microsoft.com/fwlink/?LinkID=113278
17.6.2009 0:00:00 Add-Computer http://go.microsoft.com/fwlink/?LinkID=135194
PS C:\> get-help *-* | New-TempObj |? { $_.date.Year -eq 2010 } | Select date, name
date name
---- ----
17.2.2010 0:00:00 Get-Counter
17.2.2010 0:00:00 Import-Counter
17.2.2010 0:00:00 Export-Counter
17.2.2010 0:00:00 Start-Job
20.1.2010 0:00:00 New-Module
17.2.2010 0:00:00 Get-Module
17.2.2010 0:00:00 Out-File
17.2.2010 0:00:00 Read-Host
17.2.2010 0:00:00 Export-Clixml
17.2.2010 0:00:00 Select-XML
17.2.2010 0:00:00 Join-Path
20.1.2010 0:00:00 Get-Location
20.1.2010 0:00:00 Set-Location
20.1.2010 0:00:00 Push-Location
20.1.2010 0:00:00 Pop-Location
20.1.2010 0:00:00 New-Item
2 komentáře:
Pěkné. Skoro mám pokušení dát si to do schedulovaných tasků a dělat si diffy a mrkat, kde se co změnilo :) Pěkněs to vymyslel.
Another way to get the help url :)
Get-Command -Verb Add | Where-Object {$_.HelpUri} | Select-Object Name,HelpUri
And if you don't want to mess with string parsing:
$request = [System.Net.WebRequest]::Create($url)
$LastModified = $request.GetResponse().LastModified
$LastModified
Okomentovat