Modification date of user profile photo

Slawomir Zurawski 0 Reputation points
2023-04-28T05:54:46.7933333+00:00

Hi,

I'm downloading all users' photos once a day, using Get-UserPhoto. It's a dumb approach, thus time-consuming. Is there a way to check, when the picture has been uploaded? Has the object even got such a property? I'd like to process updated ones only.

BR,

Sławek

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
817 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,551 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jarvis Sun-MSFT 8,076 Reputation points Microsoft Vendor
    2023-04-28T09:19:49.5466667+00:00

    Hi @Slawomir Zurawski ,

     

    As far as I know, the Get-userphoto command has no parameters to implement to check when the photo is uploaded, please refer to: Get-UserPhoto (ExchangePowerShell) | Microsoft Learn


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Limitless Technology 43,231 Reputation points
    2023-04-28T14:09:22.16+00:00
    
    
    Hello there,
    
    Perhaps something like this script might help you out in saving your time.
    
    $wmi = [WMI] ""
    $results = get-wmiobject Win32_UserProfile | foreach-object {
      $userAccount = [WMI] ("root/cimv2:Win32_SID.SID='{0}'" -f $_.SID)
      $userName = "{0}\{1}" -f $userAccount.ReferencedDomainName,$userAccount.AccountName
      new-object PSObject -property @{
        "Name" = $userName
        "LastUseTime" = $wmi.ConvertToDatetime($_.LastUseTime)
      }
    }
    $results | export-csv mycsv.csv -notypeinformation
    
    Similar thread here https://social.technet.microsoft.com/Forums/en-US/51fd80b5-c146-40af-807d-455727d1b1e4/is-it-possible-to-find-out-each-user-profile-and-the-last-modified-date-from-ntuserdat-using-a?forum=ITCG
    
    Hope this resolves your Query !!
    
    --If the reply is helpful, please Upvote and Accept it as an answer–
    
    0 comments No comments