Remove User from AD Group

drewc
Mega Contributor

Is the "Remove User from Group" Active Directory workflow activity available in Geneva? I see "Add User" but not Remove.

1 ACCEPTED SOLUTION

Shahed Shah1
Tera Guru

Hi Drew



The "Remove User from Group" activity was introduced in the Helsinki release. For reference it is listed here in the Helsinki release notes:


Orchestration release notes



Hope that helps


Shahid


View solution in original post

5 REPLIES 5

ian_cox
ServiceNow Employee
ServiceNow Employee

Here is what I found in the Geneva Product Docs.   Active Directory activity pack. I couldn't find a remove user from Group listed.


Shahed Shah1
Tera Guru

Hi Drew



The "Remove User from Group" activity was introduced in the Helsinki release. For reference it is listed here in the Helsinki release notes:


Orchestration release notes



Hope that helps


Shahid


ian_cox
ServiceNow Employee
ServiceNow Employee

Drew,   Please let us know if this answered your question we want to make sure you have question answered.


drewc
Mega Contributor

Pre-packaged Remove User from Group Active Directory workflow activity is available in Helsinki and beyond.



However, the PowerShell script to run is very simple:



Remove-ADGroupMember -server {Domain Controller IP} -identity {exact name of group} -member {samaccountname of grp member} -Confirm:$false



gotchas:
*make sure that the credentials have enough rights to actually perform the remove


*-Confirm:$false is required since it's automatically running in non-interactive mode


*don't put any double-quotes in the command (contrary to examples found online; once I removed double-quotes, it worked for me); declare variables as strings before the command



example:


$member = "${current.variables.test}"


Remove-ADGroupMember -server {server ip} -identity Test -member $member -Confirm:$false