This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PowerShell Workflow - where to go next?

I have a powershell script that I want to run nightly that will go and check three designated groups and remove any disabled users.  (this is for a licensing thing)  The script works fine.  I could run it with a scheduled task, but I'd rather do it with a scheduled workflow.  I am confused on what function I should choose to add the script?

Import-Module ActiveDirectory

$groups = "Test Group Universal", "Test Group Global", "Test Group Domain Local"

foreach($group in $groups){

$DisabledUser = Get-ADGroupMember -Identity "$group" | Get-ADUser | Where-Object {$_.Enabled -eq $false} | Where-Object {$_.SamAccountName -notlike "_New*"}

Remove-ADGroupMember -Identity $group -Members $DisabledUser -Confirm:$false

}

Parents
  • Is there a reason you wouldn’t simply want to have a workflow do this? The advantages of that approach is that it is usually easier to see the logic of a workflow for others (or if it’s been awhile since you looked at the script), and tighter integration with Active Roles Services. For instance, it would be trivial to add a notification to certain people that these activities had occurred, or to add specific entries into the audit trail of the users or groups.

Reply
  • Is there a reason you wouldn’t simply want to have a workflow do this? The advantages of that approach is that it is usually easier to see the logic of a workflow for others (or if it’s been awhile since you looked at the script), and tighter integration with Active Roles Services. For instance, it would be trivial to add a notification to certain people that these activities had occurred, or to add specific entries into the audit trail of the users or groups.

Children
No Data