Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Please add Get-GSCalendar & Remove-GSCalendarACL #163

Closed
kevinblumenfeld opened this issue Mar 19, 2019 · 2 comments
Closed
Assignees

Comments

@kevinblumenfeld
Copy link

Is your feature request related to a problem? Please describe.
This is not related to a problem

Describe the solution you'd like
Would love to be able to query specific calendars and remove ACL's. Specifically, “Make changes AND manage sharing” ACL

Describe alternatives you've considered
Considered GAM but hey that's not PowerShell and can't accomplish it this way.

Additional context
Thank you. This is specifically what I am running into: https://support.quest.com/on-demand-migration-for-email/kb/111726/shared-calendars-from-google-g-suite-get-migrated-to-office-365-as-a-new-calendar

@kevinblumenfeld kevinblumenfeld changed the title Please add Get-GSCalendar & Remove-GSCalendarACL [Feature Request] Please add Get-GSCalendar & Remove-GSCalendarACL Mar 19, 2019
@scrthq scrthq self-assigned this Mar 19, 2019
@scrthq
Copy link
Member

scrthq commented Mar 19, 2019

Thanks, @kevinblumenfeld!!! I'll let you know as soon as I have this out! Shouldn't take long to implement.

@scrthq
Copy link
Member

scrthq commented Mar 20, 2019

Get-GSCalendar and Remove-GSCalendarAcl added into v2.25.0 along with a number of other improvements!

To do what you're after, I believe this would work for you:

$targetUser = '[email protected]'
Get-GSCalendar -User $targetUser | Where-Object {$_.AccessRole -eq 'Owner'} | 
    Get-GSCalendarAcl | Where-Object {$_.Role -eq 'Owner' -and $_.Scope.Value -ne $targetUser} | 
    Remove-GSCalendarAcl -WhatIf

This...

  1. Gets the calendar list where the $targetUser is the Owner
  2. Gets the ACL rules for each calendar where the rule Role is Owner (this equates to Manage Events & Sharing) and the scope of the rule is not the $targetUser (here to prevent removal of self or potential errors)
  3. Removes the matching rules from the calendars they are on.

Let me know how this works for you! v2.25.0 is on the Gallery now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants