<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Playbook to search AD expired accounts and delete them in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504794#M992</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/208955"&gt;@pottapitot&lt;/a&gt;, you can use the extend context option to save the data to the context in the&amp;nbsp;&lt;SPAN&gt;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&amp;nbsp;refer -&amp;nbsp;&lt;A href="https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context" target="_blank"&gt;https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-06-20 at 12.32.03 pm.png" style="width: 596px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/41889i435616C4CCC0C6C7/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-06-20 at 12.32.03 pm.png" alt="Screen Shot 2022-06-20 at 12.32.03 pm.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jun 2022 02:34:51 GMT</pubDate>
    <dc:creator>jfernandes1</dc:creator>
    <dc:date>2022-06-20T02:34:51Z</dc:date>
    <item>
      <title>Playbook to search AD expired accounts and delete them</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504495#M985</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create a playbook that&lt;/P&gt;&lt;P&gt;1) Searches for expired accounts in AD&lt;/P&gt;&lt;P&gt;2) Retrieves the sAMAccountName, Display name and expired date&lt;/P&gt;&lt;P&gt;3) Delete the accounts&amp;nbsp;&lt;/P&gt;&lt;P&gt;4) Sent an email notification with the details of the accounts deleted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the ldap query for the same and one factor was to get the current time to use in the query.&lt;/P&gt;&lt;P&gt;There is a function call DateTimetoADTime in XSOAR which can be used for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The LDAP query is as follows&lt;/P&gt;&lt;P&gt;(&amp;amp;(objectCategory=person)(objectClass=user)(!accountExpires=9223372036854775807)(!accountExpires=0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the current date in AD format using&lt;/P&gt;&lt;P&gt;DatetimetoADTime days_ago=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I append to the LDAP query above to get the result using ad-search (xsoar function) like so&lt;/P&gt;&lt;P&gt;(&amp;amp;(objectCategory=person)(objectClass=user)(!accountExpires=9223372036854775807)(!accountExpires=0))(accountExpires&amp;lt;=&amp;lt;output given from DatetimetoADTime&amp;gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works in the playground where I get the display names only though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 16:08:04 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504495#M985</guid>
      <dc:creator>pottapitot</dc:creator>
      <dc:date>2022-06-17T16:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Playbook to search AD expired accounts and delete them</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504794#M992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/208955"&gt;@pottapitot&lt;/a&gt;, you can use the extend context option to save the data to the context in the&amp;nbsp;&lt;SPAN&gt;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&amp;nbsp;refer -&amp;nbsp;&lt;A href="https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context" target="_blank"&gt;https://xsoar.pan.dev/docs/playbooks/playbooks-extend-context&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-06-20 at 12.32.03 pm.png" style="width: 596px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/41889i435616C4CCC0C6C7/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-06-20 at 12.32.03 pm.png" alt="Screen Shot 2022-06-20 at 12.32.03 pm.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 02:34:51 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504794#M992</guid>
      <dc:creator>jfernandes1</dc:creator>
      <dc:date>2022-06-20T02:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Playbook to search AD expired accounts and delete them</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504935#M994</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/208028"&gt;@jfernandes1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That was exactly what I was looking for.&amp;nbsp;Thanks alot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 16:34:30 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/playbook-to-search-ad-expired-accounts-and-delete-them/m-p/504935#M994</guid>
      <dc:creator>pottapitot</dc:creator>
      <dc:date>2022-06-20T16:34:30Z</dc:date>
    </item>
  </channel>
</rss>

