So I want to change the permissions to a bunch of OneDrive users (sharepoint online) from full control to reader. There doesn’t seem to be any easy way to do this. Everything I search is how to create the group, set the access, and then add the user. I was not able to find anything that would just change the user access in onedrive.
I’m assuming that I could do a remove-spo user, create a readers group, then re-add the user back in, but I would think there would be an easier way.
I’m somewhat new to powershell and know even less about how sharepoint online works; so any actual code would help.
I’m not an expert on the subject by any means, but I did find a useful resource which may be along the lines of what you’re looking for.
I believe the easiest way would be to create the new group, add all the users into the new group, then remove the previous permissions. Without a test environment, I can’t give you much more than a scaffold for what your code will end up looking like.
New-SPOSiteGroup -Site $yoursite -Group $newgroup -PermissionLevels "Readers"
Then I’d get a list of users in the old group:
$myusers = Get-SPOUser -Site $yoursite -Group $oldgroup
And add/remove the users to the appropriate groups. The guide I linked has code on how to do that as well. Basically you’ll pipe $myusers into the add function for the new group, and once that’s done you can do the same to remove them from the old group. Let me know if you have more questions!
Thanks Bryce…that’s what I was assuming that I would need to do. It just seems weird that it allows you to create/edit permissions/delete groups, but doesn’t have anything for users.