Hi.
I could not reply to the original post from 5 years ago. I have included the link below for reference. If you are still on the site, thank you, Nick.Dollimount , the code you provided is fantastic. I have modified it slightly as I need temp group membership on some groups in terms of hours rather than days.
Again, thank you, and I hope this helps someone else in the future.
# BEGIN SCRIPT # function temporalGroupMembership($Request){ $users = $workflow.SavedObjectProperties("AddedMembers").getEx("member") $groupDN = $Request.Get("distinguishedName") $time = (Get-Date).AddMinutes(60).ToUniversalTime() # Modify here for the amount of time. $hash = @{} $hash.add("ScheduledOperation-SetTime",$time) foreach($userDN in $users){ Remove-QADGroupMember -Identity $groupDN -Member $userDN -Control $hash } } # END SCRIPT #