PS: replace chunk of htmlblock (by data queried by powershell) in html page via Powershell RRS feed

  • Question




    I have a pretty complex html page (which I use Dreamweaver to edit) in which I 'd like to add dynamic items.

    F.e. I'd like to add (in this "complex html page") "Windows Update deployment success rate", then the % which I get from SCCM.


    So the idea is to keep this html page as is and replace items with results of powershell queries.


    F.e. method to be used would be

    $HtmlBlockToReplace =  <td> <div align="center"></div></td>

    $HtmlBlockNew = <td> <div align="center">94%</div></td>


    (Get-Content -Path $pathofindexfile).replace($HtmlBlockToReplace,$HtmlBlockNew ) | Set-Content -Path $pathofindexfile



    My question: howto correctly select the htmlblock in an htmlpage so I can replace it?

    I could add a specific tag in the html in order to detect it, f.e.  Thisisthetag123 but howto select the chunk of code then?

    Hope this is clear. Please advise.




    • Moved by Bill_Stewart Friday, January 26, 2018 3:19 PM Unanswerable drive-by question
    Thursday, December 7, 2017 4:58 PM

All replies