Website parsing


hello powershell guru's!

i'm new powershell , hoping help..

i want write ps script parse webpage , grab version number. know it's possible don't know enough yet..

invoke-webrequest looks way go, i'm in dark when comes parsing webpage etc.

so want parse http://www.storagecraft.com/software_update.php and pull out "shadowprotect installers" , version number (v5.0.3).

once know how that, can query registry , match version number what's installed.

any or pointers on best way go appreciated!

andy

hi,

i came across these links information:

http://powershellcommunity.org/forums/tabid/54/aft/8069/default.aspx

http://powershell.com/cs/forums/t/10564.aspx

i haven't used webclient class myself, decided give try. following code works me:

$url = "http://www.storagecraft.com/software_update.php" $webclient = new-object system.net.webclient $html = $webclient.downloadstring("$url")  $versioncheck = (($html.substring($html.lastindexof("shadowprotect installers</th>") + 29, 20)).replace("<th>","")).replace("</th>","").trim() $versioncheck

might break if page changes in future, seems fine now.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...