Powershell script to delete the roaming profile path entry in ADUC for several users

Punkasur 21 Reputation points
2021-03-30T13:48:10.787+00:00

Hi,

We have an issue with using FSLogix and the existing AD setup where roaming profile path is set in the ADUC under the Profile Tab. If you have profile set on AD and you want to use FSLogix to manage roaming profile, this will not work as its obviously going to clash which GPO/AD setting to honor when you login. We are moving away from roaming profiles, so the only way for this to work is to set FSLogix as intended via standard GPO settings to manage roaming profile, and then delete the Roaming Profile path entry in ADUC.

Now i need to delete this for around 600 users. They are all in a security group. So i wonder if there if you can help with a powershell script to mass delete the roaming profile path entry with the security group as the targer object? Any help would be appreciated.

Thanks
Punkasur

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.5K Reputation points MVP Volunteer Moderator
    2021-03-30T14:08:15.197+00:00

    Hi @Punkasur ,

    maybe this helps - Not tested by myself / use on your own risk!:

    #Try one user first  
    Get-ADUser -Identity "<testUser-samAccountName>" -Properties ProfilePath | Set-ADUser -Clear ProfilePath  
      
    # Not tested by myself - use on your own risk!  
    Get-ADGroupMember -Identity "<YourGroupContainingUsers-Name>" | Where-Object {$_.objectClass -eq "user"} | Set-ADUser -Clear ProfilePath  
    

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Padmanabhan Vaidyanathan (Paul) 1 Reputation point
    2021-07-23T09:54:56.157+00:00

    Hi Andreas,

    I just wanted to say thank you for the script, worked like a charm.

    Regards,
    Paul.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.