none
O365 upload picture, random proxy error Set-Photo RRS feed

  • Question

  • The code works 90 percent of the time.  Error on Proxy Set-UserPhoto with a lot of red numbers.  Then after it works, it works for 20 times or more times.

    Hybrid O365

    Looks like other people having issue.

        $Session = New-PSSession -ConfigurationName Microsoft.Exchange  -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxymethod=rps -Credential $O365Credentials -Authentication Basic -AllowRedirection
    
        Import-PSSession $Session -AllowClobber -DisableNameChecking
        Connect-MsolService -Credential $O365Credentials
    
        #Get-AcceptedDomain
        #Get-MsolCompanyInformation | select  DisplayName
        Import-CSV D:\files\ePhotoLOGS\ePhoto_Work_File.csv -Header EmpID,UsrID | Foreach-Object{
    
            Set-UserPhoto -Identity $($_.UsrID) -PictureData ([System.IO.File]::ReadAllBytes("D:\files\photo\$($_.UsrID)\O365\$($_.UsrID).png")) -Confirm:$false
    
        }


    • Moved by Bill_Stewart Thursday, January 25, 2018 10:38 PM This is not "fix/debug/rewrite my script for me" forum
    Thursday, November 9, 2017 3:54 PM

All replies

  • You MUST post the complete error message.  Copy and paste it from the console.  Do not post a screen capture.  It is likely that the file cannot be converted or is not found. You CSV cannot have any blank columns.

    The following will give you the correct information.

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxymethod=rps -Credential $O365Credentials -Authentication Basic -AllowRedirection
    Import-PSSession $Session -AllowClobber -DisableNameChecking
    Connect-MsolService -Credential $O365Credentials
    
    Import-CSV D:\files\ePhotoLOGS\ePhoto_Work_File.csv -Header EmpID, UsrID | 
        Foreach-Object{
            Try{
                $photo = [System.IO.File]::ReadAllBytes("D:\files\photo\$($_.UsrID)\O365\$($_.UsrID).png")
                Set-UserPhoto -Identity $_.UsrID -PictureData $photo -Confirm:$false -ErrorAction Stop
            }
            Catch{
                Throw $_
            }
        
    }
    


    \_(ツ)_/

    Thursday, November 9, 2017 7:39 PM
  • Script     1.0        tmp_efhlfvqx.utt                    {Add-AvailabilityAddressSpace, Add-DistributionGroupMember, Add-MailboxFolderPer...
    Error on proxy command 'Set-UserPhoto -Identity:'XXXXXX' -PictureData:'137','80','78','71','13','10','26','10','0','0','0','13','73','72','6
    8','82','0','0','2','136','0','0','2','136','8','2','0','0','0','124','43','156','237','0','0','128','0','73','68','65','84','120','218','148
    ','189','189','139','27','221','242','45','236','191','243','166','39','52','111','112','49','191','224','48','156','228','97','120','2','51'
    ,'56','48','194','129','17','14','12','114','96','144','3','131','28','12','180','3','67','59','152','96','7','10','90','129','160','21','8',
    '90','129','130','14','28','40','120','130','121','119','173','143','218','61','231','222','228','66','51','200','178','212','146','250','99'
    ,'87','213','170','181','86','189','26','247','253','116','42','183','235','56','29','75','125','60','159','134','249','60','140','135','190'
    ,'254','179','62','152','47','245','159','229','118','25','110','115','125','92','98','171','255','188','14','243','41','30','196','118','42'
    Friday, November 10, 2017 2:04 PM
  • This was the error, be for the try. I put that in and see can get more errors.  Of course it working today.
    Friday, November 10, 2017 2:26 PM
  • I tried Mon 13 and it failed, but I did not Catch the error in text file.  It worked the second time I tried it.

    Here is what I put in the catch:

    Try{

               

    $photo=[System.IO.File]::ReadAllBytes("D:\files\photo\$($_.UsrID)\O365\$($_.UsrID).png")

               

    Set-UserPhoto-Identity$_.UsrID -PictureData$photo-Confirm:$false-ErrorActionStop


            }

           

    Catch{

              

    Write-Error$_.Exception

              

    Throw$_.Exception

              

    $_.Exception |Out-FileD:\files\ePhotoLOGS\ePhotoerrors.txt-Append


            }

    Monday, November 13, 2017 1:37 PM
  • Error on proxy command 'Set-UserPhoto -Identity:'XXXXXX' -PictureData:'137','80','78','71','13','10','26','10','0','0','0','13','73','72','6
    8','82','0','0','2','136','0','0','2','136','8','2','0','0','0','124','43','156','237','0','0','128','0','73','68','65','84','120','218','148
    ','189','189','139','27','221','242','45','236','191','243','166','39','52','111','112','49','191','224','48','156','228','97','120','2','51'
    ,'56','48','194','129','17','14','12','114','96','144','3','131','28','12','180','3','67','59','152','96','7','10','90','129','160','21','8',
    '90','129','130','14','28','40','120','130','121','119','173','143','218','61','231','222','228','66','51','200','178','212','146','250','99'
    ,'87','213','170','181','86','189','26','247','253','116','42','183','235','56','29','75','125','60','159','134','249','60','140','135','190'
    ,'254','179','62','152','47','245','159','229','118','25','110','115','125','92','98','171','255','188','14','243','41','30','196','118','42'
    ,'241','202','250','207','75','188','184','238','234','249','54','225','93','67','221','231','243','109','188','253','25','230','107','185','
    221','198','231','127','166','249','58','222','230','233','249','159','185','190','166','238','228','249','207','168','23','215','253','215',
    '199','245','249','63','211','243','28','79','226','5','99','252','179','62','249','156','219','45','254','254','131','45','30','223','248','
    248','246','103','158','47','117','207','99','221','63','246','86','166','83','63','157','123','252','45','227','161','196','207','169','223'
    ,'243','20','15','134','210','213','47','28','63','22','191','241','118','25','227','39','28','252','195','247','125','221','110','127','166'
    ,'250','125','234','219','199','125','23','63','246','92','95','223','215','35','80','191','21','247','19','159','85','95','92','240','226','
    235','200','143','136','35','195','119','29','186','250','119','142','143','238','234','30','234','123','235','183','138','61','215','143','6

    CY1PR10MB0810.namprd10.prod.outlook.com: Server version 15.20.0218.0000, Proxy method RPS:

    The WinRM client cannot process the request. The connection string should be of the form [<transport>://]<host>[:<port>][/<suffix>] where

    transport is one of "http" or "https". Transport, port and suffix are optional. The host may be a hostname or an IP address. For IPv6

    addresses, enclose the address in brackets - e.g. "http://[1::2]:80/wsman". Change the connection string and try the request again.  .

        + CategoryInfo          : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException

        + FullyQualifiedErrorId : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.RecipientTasks.SetUserPhot

       o

        + PSComputerName        : outlook.office365.com

     

    Monday, November 13, 2017 3:57 PM
  • I still have not been able to capture complete error message. It still randomly does not work.  Get the above error. 

    Any suggestions?

    Tuesday, November 14, 2017 8:55 PM
  • I am having the same issues. It looks like the RPS method has been removed but I cannot find another proxy method that works.
    Monday, November 20, 2017 3:05 PM