none
How to code it using Powershell Script? RRS feed

  • Question

  • Referring to following coding, when I run it, the Web_News.txt do not contain all contents within the web site.

    However, when I go to the web site, and save the web page as a text file, which contain all contents within the web site.

    I would like to know on how to code PowerScripts to save a web page into text file instead of using WebRequest.

    Does anyone have any suggestions?
    Thanks in advance for any suggestions

    $url = "https://www.yahoo.com/news/"
    (Invoke-WebRequest -Uri $url -SessionVariable Y -UseBasicParsing).Content | Out-File -FilePath D:\Web_News.txt


    Thanks in advance for any suggestions


    • Edited by oemMicrosoft Tuesday, January 2, 2018 1:21 PM
    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:25 PM Help vampire "question"
    Tuesday, January 2, 2018 7:25 AM

All replies

  • Does anyone have any suggestions?
    Thanks in advance for any suggestions


    Thanks in advance for any suggestions

    Tuesday, January 2, 2018 1:22 PM
  • When I run what you've posted, it works fine. Unless there's more content that you're wanting than what is being returned. 

    Your exact phrasing was "Web_News.txt do not contain all contents within the web site.". Are you getting data, just not the data that you were expecting?


    Jeremy Corbello | https://www.jeremycorbello.com

    Thursday, January 4, 2018 2:15 PM