# Get-MgUserPhotoContent returns zero-length file

**URL:** <https://forums.powershell.org/t/get-mguserphotocontent-returns-zero-length-file/25740>\
**Category:** PowerShell Help\
**Created:** [April 25, 2025, 3:02pm UTC](https://forums.powershell.org/t/get-mguserphotocontent-returns-zero-length-file/25740 "2025-04-25T15:02:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![grey0ut](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/grey0ut/32/5310_2.png) [@grey0ut](https://forums.powershell.org/u/grey0ut)\
**Post date:** [April 25, 2025, 5:54pm UTC](https://forums.powershell.org/t/get-mguserphotocontent-returns-zero-length-file/25740/2 "2025-04-25T17:54:31Z")

</div>

Hello and welcome to the forum.  
Please remember when you’re posting any kind of code to use the Preformatted Text option to properly format your code:  
[Guide to Posting Code](https://forums.powershell.org/t/guide-to-posting-code/14928)

Just for clarification, you’re running the line as you shared correct? Suppressing errors? Are there any errors that occur when the output file results in a 0-byte file?  
I see running a loop against all my team members that while it successfully downloads the photo for each one (over multiple attempts) it generates an error each time

```auto
Get-MgUserPhotoContent_Get:
Line |
   3 | Get-MgUserPhotoContent -UserId $user -OutFile $file
     | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot set percent because PercentComplete cannot be greater than 100. (Parameter 'value')
Actual value was 2147483647.

```

Regardless this doesn’t seem to create an issue.

Can you share some more details about **when** this fails on your end?

---

_[View the full topic](https://forums.powershell.org/t/get-mguserphotocontent-returns-zero-length-file/25740)._
