How to fix broken images after mySite URL change in SharePoint 2010?

January 27th, 2012

11 Responses so far.

  1. Hey,

    Awesome script really saved me!! I just had to fix one minor thing:

    $userProfiles = $profileManager.GetEnumerator()

    This line should actually be:
    $userProfiles = $userprofileManager.GetEnumerator()

    As that is the variable created by the previous statement.


  2. Norman Bauer says:

    Oh thanks. I fixed that one.

  3. Peter says:


    I’ve just changed the URL of the My Site, and I’m having a bit of issues with this script, since I’m a complete newbie to Powershell.

    When trying to run the script I’m getting prompted for TypeName, could you tell me what I’m doing wrong here? Thanks!

  4. Peter says:

    Thanks a lot for this script, saved me heaps of trouble!
    In regards to the comment above, I was getting some errors due to the fact that I wasn’t running the script as a user with permissions to change the MySite.

  5. Norman Bauer says:

    You’re welcome… At least I did not mention that you better run this script in a Powershell elevated by a farm administrator. Thanks for the hint on that.

  6. Jonathon McDougall says:

    I was having trouble changing my URL from http://portal/my/ to http://portal/ – The script ran fine, but the old and new URLS were the same. I changed this line:

    $newPictureUrl = $oldPictureUrl.Replace($mySiteOldUrlValue, $mySiteNewUrlValue)


    $newPictureUrl = $oldPictureUrl -Replace($mySiteOldUrlValue, $mySiteNewUrlValue)

    and everything worked.

  7. […] How to fix broken images after MySite URL change in SharePoint 2010 […]

  8. Duane Alleman says:

    I have run this script and it completes without errors, but I noticed the path for some of the photos is:
    oldPictureUrl = photos/profile picturesUser Photos/Profile Pictures/me_MThumb.jpg –> newPictureUrl = photos/profile picturesUser Photos/Profile Pictures/me_MThumb.jpg

    Any ideas how I can correct the duplicate path? If I manually remove the duplicate user photos/profile pictures (so that there is only 1 in the path) then it displays the picture in the browser.

    Any help would be greatly appreciated.

  9. Norman Bauer says:

    @Duane Alleman
    You could simply edit the script not to replace old vs. new url but replace that “double” url:

    $newPictureUrl = $oldPictureUrl -Replace "user photos/profile picturesUser Photos/Profile Pictures", "user photos/profile pictures"
  10. Norman Bauer says:

    @Jonathon McDougall
    Thanks for the hint, I changed that.

Captcha: * Time limit is exhausted. Please reload CAPTCHA.