# Want to download web url content

**URL:** <https://forums.powershell.org/t/want-to-download-web-url-content/10692>\
**Category:** PowerShell Help\
**Created:** [May 22, 2018, 5:35am UTC](https://forums.powershell.org/t/want-to-download-web-url-content/10692 "2018-05-22T05:35:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit-parmar](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@ankit-parmar](https://forums.powershell.org/u/ankit-parmar)\
**Post date:** [May 22, 2018, 5:35am UTC](https://forums.powershell.org/t/want-to-download-web-url-content/10692/1 "2018-05-22T05:35:21Z")

</div>

Hi All,

I have one url and I want to download the all web url content and copy it to some text file but unable to do so. That URL have username and password as well so please guide how to do this. Do I need to pass credentials also in script. If yes, then how. Any insight would be appreciated.

Till now code is -

> Invoke-WebRequest -Uri abc.com/#/queues -Credential "guest" $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile('abc.com/#/queues/%2F/onp.document.dlq','C:\Users\ankitpar\test.txt')

but on executed it’s not giving the desired result. It’s not copying the web page.

Thanks  
Ankit

---

<div class="post-metadata">

**Author:** ![ta11ow](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/ta11ow/32/131_2.png) [@ta11ow](https://forums.powershell.org/u/ta11ow)\
**Post date:** [May 22, 2018, 11:18am UTC](https://forums.powershell.org/t/want-to-download-web-url-content/10692/2 "2018-05-22T11:18:09Z")

</div>

A brief illustration:

```
$Cred = Get-Credential
$Webclient.Credentials = $Cred
$Webclient.DownloadFile($Url,$Destination)
```

Personally I find this stuff a bit easier with the built in Invoke-WebRequest cmdlet, but either works, really. 🙂

---

<div class="post-metadata">

**Author:** ![ankit-parmar](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@ankit-parmar](https://forums.powershell.org/u/ankit-parmar)\
**Post date:** [May 23, 2018, 6:45am UTC](https://forums.powershell.org/t/want-to-download-web-url-content/10692/3 "2018-05-23T06:45:38Z")

</div>

Hi Joel,

Thanks for replying but I have already tried this via google but didn’t get the actual result. The issue is on web url there is a tab of “get-message” and after clicking on that tab the result will show. In my case i think i have to call the “get-message” tab in script and after that only then the result will come so do you have any idea that how to do this?

Thanks in advance  
Ankit

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:35pm UTC](https://forums.powershell.org/t/want-to-download-web-url-content/10692/4 "2024-05-16T20:35:02Z")

</div>


