Project

PSAutomator

This PowerShell Module is new approach to onboarding, offboarding and business as usual processes running in companies infrastructure.

Stars71
Forks16
Open issues6
PowerShell Gallery downloads5310
Language: PowerShell Updated: 2024-12-22T17:55:26.0000000+00:00

Curated Examples

Preview group-triggered disable workflow

Use PSAutomator to preview a group-triggered account disable workflow.

This pattern is useful when group membership drives a directory action but conditions should be visible in the workflow definition.

It is adapted from Examples/RunBook.UsersDisable.ps1.

Example

Import-Module PSAutomator
Import-Module PSSharedGoods

Service -Name 'Active Directory Disable Users in Group' {
    Trigger -Name 'Member of disabled users group' -User GroupMembership -Value 'Disabled Users' |
        Condition -Name 'Email is not service account domain' -Condition Field -Value @{
            Field = 'EmailAddress'
            Operator = 'notlike'
            Value = '*@service.example.com'
        } |
        Condition -Name 'Email address is present' -Condition EmptyOrNull -Value EmailAddress |
        Action -Name 'Disable users' -ActiveDirectory AccountDisable -WhatIf
}

What this demonstrates

  • using group membership as a trigger
  • adding conditions before the account action
  • keeping the action in preview mode

Source