<?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: How to generate CSV or TXT report of the users under user's group in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115679#M5780</link>
    <description>&lt;P&gt;The script you listed requires you to provide the group name as the first argument.&lt;BR /&gt;See below and replace &lt;STRONG&gt;&amp;lt;GROUP_NAME&amp;gt;&lt;/STRONG&gt; with your group.&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;/home/admin/show_usergroup_members.sh &amp;lt;GROUP_NAME&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If you have API version 1.6.1 or above, you can also use `show-user-group` as suggested:&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;mgmt_cli -r true show-user-group name '&amp;lt;GROUP_NAME&amp;gt;' -f json| jq -r '.members[] | [.name, .type] | @csv'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be aware that both commands will list &lt;U&gt;all&lt;/U&gt; members of the group (including administrators and other user-groups), not just users. For administrators it will show an empty string in the `type` column.&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;# output from previous command
"admin",""
"api_user",""
"banana","user"
"another_usergroup","user-group"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Documentation&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="10%" height="24px"&gt;API / mgmt_cli&lt;/TD&gt;
&lt;TD width="50%" height="24px"&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7" target="_blank" rel="noopener noreferrer"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="10%" height="24px"&gt;jq&lt;/TD&gt;
&lt;TD width="50%" height="24px"&gt;&lt;A href="https://stedolan.github.io/jq/" target="_blank" rel="noopener"&gt;https://stedolan.github.io/jq/&lt;/A&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Fri, 09 Apr 2021 13:10:35 GMT</pubDate>
    <dc:creator>Jonas_Rosenboom</dc:creator>
    <dc:date>2021-04-09T13:10:35Z</dc:date>
    <item>
      <title>How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115238#M5752</link>
      <description>&lt;P&gt;Seeking for assistance on how to generate CSV or TXT report of the list of users under user's group.&lt;/P&gt;&lt;P&gt;Tried below scripts but not works on my lab.&lt;/P&gt;&lt;P&gt;--------------------------&lt;/P&gt;&lt;P&gt;#!/bin/sh&lt;BR /&gt;JQ=/opt/CPshrd-R80.40/jq/jq&lt;BR /&gt;GROUP_NAME=$1&lt;BR /&gt;USERS_FILE="users.json"&lt;BR /&gt;USER_FILE="user.json"&lt;BR /&gt;USER_NAMES_FILE="$GROUP_NAME.txt"&lt;BR /&gt;&amp;gt; $USER_NAMES_FILE&lt;BR /&gt;/opt/CPshrd-R80.40/bin/mgmt_cli -r true show generic-objects name $GROUP_NAME details-level full -f json &amp;gt; $USERS_FILE&lt;BR /&gt;if [ $? -ne 1 ]; then&lt;BR /&gt;USERS_UIDS=($($JQ -r '.objects[] | .emptyFieldName[] | .' $USERS_FILE))&lt;BR /&gt;for USER_UID in ${USERS_UIDS[@]}; do&lt;BR /&gt;echo 'User UID: '"$USER_UID"&lt;BR /&gt;/opt/CPshrd-R80.40/bin/mgmt_cli -r true show generic-object uid $USER_UID -f json &amp;gt; $USER_FILE&lt;BR /&gt;if [ $? -ne 1 ]; then&lt;BR /&gt;USER_NAME=($($JQ -r '.name' $USER_FILE))&lt;BR /&gt;echo 'User Name: '"$USER_NAME"&lt;BR /&gt;echo $USER_NAME &amp;gt;&amp;gt; $USER_NAMES_FILE&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;--------------------------------&lt;/P&gt;&lt;P&gt;I'm getting this errors.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;The parameters of show-generic-objects command should be provided in pairs (key and value). You have provided an odd number of parameters which suggests that you are probably missing a paramete&lt;/STRONG&gt;r.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: I'm using R80.40 management server.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 07:58:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115238#M5752</guid>
      <dc:creator>mrvic02</dc:creator>
      <dc:date>2021-04-05T07:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115243#M5754</link>
      <description>&lt;P&gt;Why so complicated ?&lt;/P&gt;
&lt;P&gt;There is "show user-groups" and "show user-group" APIs which can be used.&lt;/P&gt;
&lt;P&gt;If not possible, then try to replace your "show generic-objects" with "show object" (also valid API command).&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 08:59:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115243#M5754</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2021-04-05T08:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115244#M5755</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/1702"&gt;@JozkoMrkvicka&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please provide the complete command for your suggested api commands?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Apr 2021 09:04:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115244#M5755</guid>
      <dc:creator>mrvic02</dc:creator>
      <dc:date>2021-04-05T09:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115425#M5769</link>
      <description>&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7&lt;/A&gt;&lt;BR /&gt;Note the relevant APIs are in R81 and R80.40 JHF 78+&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 19:55:54 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115425#M5769</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-04-06T19:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115679#M5780</link>
      <description>&lt;P&gt;The script you listed requires you to provide the group name as the first argument.&lt;BR /&gt;See below and replace &lt;STRONG&gt;&amp;lt;GROUP_NAME&amp;gt;&lt;/STRONG&gt; with your group.&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;/home/admin/show_usergroup_members.sh &amp;lt;GROUP_NAME&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;If you have API version 1.6.1 or above, you can also use `show-user-group` as suggested:&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;mgmt_cli -r true show-user-group name '&amp;lt;GROUP_NAME&amp;gt;' -f json| jq -r '.members[] | [.name, .type] | @csv'&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Be aware that both commands will list &lt;U&gt;all&lt;/U&gt; members of the group (including administrators and other user-groups), not just users. For administrators it will show an empty string in the `type` column.&lt;/P&gt;
&lt;LI-CODE lang="ruby"&gt;# output from previous command
"admin",""
"api_user",""
"banana","user"
"another_usergroup","user-group"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Documentation&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="10%" height="24px"&gt;API / mgmt_cli&lt;/TD&gt;
&lt;TD width="50%" height="24px"&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7" target="_blank" rel="noopener noreferrer"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-user-group~v1.7&lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="10%" height="24px"&gt;jq&lt;/TD&gt;
&lt;TD width="50%" height="24px"&gt;&lt;A href="https://stedolan.github.io/jq/" target="_blank" rel="noopener"&gt;https://stedolan.github.io/jq/&lt;/A&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 13:10:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115679#M5780</guid>
      <dc:creator>Jonas_Rosenboom</dc:creator>
      <dc:date>2021-04-09T13:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115883#M5784</link>
      <description>&lt;P&gt;I will try this one. Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:20:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115883#M5784</guid>
      <dc:creator>mrvic02</dc:creator>
      <dc:date>2021-04-13T02:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate CSV or TXT report of the users under user's group</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115886#M5787</link>
      <description>&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/7"&gt;@PhoneBoy&lt;/a&gt;&amp;nbsp;Thanks for providing the link.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 02:49:10 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-to-generate-CSV-or-TXT-report-of-the-users-under-user-s/m-p/115886#M5787</guid>
      <dc:creator>mrvic02</dc:creator>
      <dc:date>2021-04-13T02:49:10Z</dc:date>
    </item>
  </channel>
</rss>

