- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-17-2022 09:08 AM
Hi,
I am trying to create a playbook that
1) Searches for expired accounts in AD
2) Retrieves the sAMAccountName, Display name and expired date
3) Delete the accounts
4) Sent an email notification with the details of the accounts deleted.
I created the ldap query for the same and one factor was to get the current time to use in the query.
There is a function call DateTimetoADTime in XSOAR which can be used for that.
The LDAP query is as follows
(&(objectCategory=person)(objectClass=user)(!accountExpires=9223372036854775807)(!accountExpires=0))
I get the current date in AD format using
DatetimetoADTime days_ago=0
I append to the LDAP query above to get the result using ad-search (xsoar function) like so
(&(objectCategory=person)(objectClass=user)(!accountExpires=9223372036854775807)(!accountExpires=0))(accountExpires<=<output given from DatetimetoADTime>)
This works in the playground where I get the display names only though.
I tried to make a playbook out of this but I am stuck at the step after using the DateTimetoADTime, how do I give the value as input to ad-search to retrieve the users and also get the details of each user (sAMAccountName, Display name and expired date), then give the same as output to be deleted?
Thanks in advance
06-19-2022 07:34 PM
Hi @pottapitot, you can use the extend context option to save the data to the context in the DatetimetoADTime step. Then use that context key token in the following step. Use "data=" to dump all command output into the context key. For more information refer - https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context
06-19-2022 07:34 PM
Hi @pottapitot, you can use the extend context option to save the data to the context in the DatetimetoADTime step. Then use that context key token in the following step. Use "data=" to dump all command output into the context key. For more information refer - https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!