<?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: Script to export the list of users with admin privileges &amp;amp; export to remote server in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135681#M6490</link>
    <description>&lt;P&gt;How can I automatically export the above generated file to a remote server?&lt;/P&gt;&lt;P&gt;IP: 10.1.1.1&lt;/P&gt;&lt;P&gt;username: uname&lt;/P&gt;&lt;P&gt;password: passwd&lt;/P&gt;&lt;P&gt;protocol: sftp&lt;/P&gt;</description>
    <pubDate>Tue, 07 Dec 2021 01:33:23 GMT</pubDate>
    <dc:creator>nbose</dc:creator>
    <dc:date>2021-12-07T01:33:23Z</dc:date>
    <item>
      <title>Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135578#M6485</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create a script to run the following command to export the list of users with admin privileges to a text file.&lt;/P&gt;&lt;P&gt;I then need to export the file to a remote server via sftp or email.&lt;/P&gt;&lt;P&gt;Please let me know how I can accomplish it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I've done so far:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;/P&gt;&lt;P&gt;mgmt_cli show administrators --domain 'System Data' details-level "full" | egrep " name:| type:|authentication-method|permissions-profile" &amp;gt; /tmp/Checkpoint-Admin-List.txt&lt;/P&gt;&lt;P&gt;The above command requires authentication, how do I include the username and password to the above command?&amp;nbsp; I did try the -u &amp;lt;username&amp;gt; -p &amp;lt;password&amp;gt; but that did not work.&lt;/P&gt;&lt;P&gt;Do let me know how i can include the sftp/email command lines as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;nibose&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 07:38:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135578#M6485</guid>
      <dc:creator>nbose</dc:creator>
      <dc:date>2021-12-06T07:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135629#M6487</link>
      <description>&lt;P&gt;Hi Nibose,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you checked out the session management notes here?&amp;nbsp;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/login~v1.8%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/login~v1.8%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are a couple of ways to handle authentication and session creation but the way you've tried above should be fine - you might just need to quote your username and password values. Something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mgmt_cli -u "adminuser" -p "password123456" --domain "System Data"....&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 13:54:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135629#M6487</guid>
      <dc:creator>StuartGreen</dc:creator>
      <dc:date>2021-12-06T13:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135678#M6488</link>
      <description>&lt;P&gt;Original Command:&lt;/P&gt;&lt;P&gt;mgmt_cli show administrators --domain 'System Data' details-level "full" | egrep " name:| type:|authentication-method|permissions-profile" &amp;gt;Checkpoint-Admin-List.txt&lt;/P&gt;&lt;P&gt;Command entered:&lt;/P&gt;&lt;P&gt;mgmt_cli -u admuser -p letmein show administrators --domain 'System Data' details-level "full" | egrep " name:| type:|authentication-method|permissions-profile" &amp;gt;Checkpoint-Admin-List.txt&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;-bash: show: command not found&lt;BR /&gt;[Expert@SDC-CPSMGP01:0]# Error: No command name was specified!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 23:44:14 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135678#M6488</guid>
      <dc:creator>nbose</dc:creator>
      <dc:date>2021-12-06T23:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135679#M6489</link>
      <description>&lt;P&gt;Hi Stuart,&lt;/P&gt;&lt;P&gt;Just got it to work.&amp;nbsp; Apparently it appears the user ID should not contain anything related to admin, changed to a generic user and it worked.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 23:57:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135679#M6489</guid>
      <dc:creator>nbose</dc:creator>
      <dc:date>2021-12-06T23:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135681#M6490</link>
      <description>&lt;P&gt;How can I automatically export the above generated file to a remote server?&lt;/P&gt;&lt;P&gt;IP: 10.1.1.1&lt;/P&gt;&lt;P&gt;username: uname&lt;/P&gt;&lt;P&gt;password: passwd&lt;/P&gt;&lt;P&gt;protocol: sftp&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 01:33:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135681#M6490</guid>
      <dc:creator>nbose</dc:creator>
      <dc:date>2021-12-07T01:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script to export the list of users with admin privileges &amp; export to remote server</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135711#M6491</link>
      <description>&lt;P&gt;you could redirect the output from your command to a file and then transfer that to your remote server:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mgmt_cli -u "admin" -p "password" show administrators --format json &amp;gt; admin_users.json&lt;/P&gt;
&lt;P&gt;scp admin_users.json &lt;A href="mailto:admin@192.168.1.1:/home/directory" target="_blank"&gt;admin@192.168.1.1:/home/directory&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or - you could skip the transfer part and connect to the management server from your remote server using the REST API over HTTPS and save the results directly on the server / incorporate them into the next part of your workflow.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 09:34:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Script-to-export-the-list-of-users-with-admin-privileges-amp/m-p/135711#M6491</guid>
      <dc:creator>StuartGreen</dc:creator>
      <dc:date>2021-12-07T09:34:02Z</dc:date>
    </item>
  </channel>
</rss>

