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 OU-based account actions

Use PSAutomator to model an OU-triggered account workflow with WhatIf actions.

This pattern is useful when you want to review how a trigger and actions fit together before changing accounts.

It is adapted from Examples/RunBook.UsersOffboarding.1.ps1.

Example

Import-Module PSAutomator
Import-Module PSSharedGoods

Service -Name 'Active Directory Prepare Users' {
    Trigger -Name 'Offboarded users OU' -User OrganizationalUnit -Value 'OU=Users-Offboarded,OU=Accounts,DC=corp,DC=example,DC=com' |
        Condition |
        Action -Name 'Disable users' -ActiveDirectory AccountDisable -WhatIf |
        Action -Name 'Add to disabled users group' -ActiveDirectory AccountAddGroupsSpecific -Value 'Disabled Users' -WhatIf
}

What this demonstrates

  • modeling an OU-based trigger
  • chaining account actions
  • keeping changes in preview mode with -WhatIf

Source