locked
Possible to run Get-UserPhoto to return a Boolean (Powershell, Office 365) RRS feed

  • Question

  • Hi!

    I want to write a script that will basically use this command: Set-UserPhoto (https://technet.microsoft.com/en-us/library/jj218694(v=exchg.160).aspx) for any user in our company who doesn't already have a photo set. The problem is I need a list of users who don't already have a photo added. I was thinking of generating a list by running "Get-UserPhoto" on every person and adding each person who didn't have a photo. The problem is Get-UserPhoto returns an error if they don't have a photo already added.

    Is it possible to capture this error and use that to generate a boolean? How would you do this?

    Thanks!

    Wednesday, April 20, 2016 4:45 PM

Answers

  • Is it possible to capture this error and use that to generate a boolean? How would you do this?

    Your question is more about the script, you might consider posting in the dedicated scripting forum, there you should get more professional responses:

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Thursday, April 21, 2016 5:50 AM

All replies

  • Is it possible to capture this error and use that to generate a boolean? How would you do this?

    Your question is more about the script, you might consider posting in the dedicated scripting forum, there you should get more professional responses:

    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Thursday, April 21, 2016 5:50 AM
  • There's no way to delete this thread huh?
    Thursday, April 21, 2016 6:47 PM
  • Hi,

    You should be able to see the "Delete" option on the top of your question description, but it's OK to leave this thread here. We'll close this one internally.

    Thank you again for visting our forum.

    Regards,

    Ethan Hua


    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    Monday, April 25, 2016 9:29 AM