none
One drive

    Question

  • Hi ,

    I have a major issue with personal Onedrive.

    I have member named Jaco who is having a local admin access to SharePoint. He was added in all users onedrive personal site. We spoke to Jaco about his account to be deleted from the site, But was denied stating he needs access to the sites since he is the admin.

    We tried running the below script

    foreach ($login in ((get-spouser -Site  https://unit4-my.sharepoint.com).LoginName)) {if($Login.Contains('@')) { $login=$login.Replace('@','_'); $login=$login.Replace('.','_'); $login=$login.Replace('.','_'); $login="https://unit4-my.sharepoint.com/personal/"+$login; Set-SPOUser -Site $login -LoginName  jaco.Konijnenburg@unit4.com -IsSiteCollectionAdmin $false}  }

    Which worked only 10%, meaning the script deleted all of the users who's names start with Alphabet "A" and half of "B" and then later nothing happened and threw an error.

    Hence we tried modifying the script and had no luck and again it threw an error.

    So could you assist us for a valid script where "Jaco" can be deleted from all users, There are about close to 12000+ users where his name is added in their perspective ODFB owners list.

    Regards,

    Raji


    Raji

    Thursday, May 19, 2016 8:33 AM

Answers