<?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 use PowerShell to export a saved search using invoke-restmethod? in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467356#M7522</link>
    <description>&lt;P&gt;If you don't have powershell 6 then there are other ways to avoid checking certificates.  Google can help find them.&lt;/P&gt;</description>
    <pubDate>Fri, 29 May 2020 18:38:32 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-05-29T18:38:32Z</dc:date>
    <item>
      <title>How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467352#M7518</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I need to turn this:&lt;/P&gt;
&lt;P&gt;curl --insecure -k -u username "&lt;A href="https://api.splunk.company.com:443/servicesNS/username/sse_sitescope_prod_v01/saved/searches/apisearchv3/history" target="_blank"&gt;https://api.splunk.company.com:443/servicesNS/username/sse_sitescope_prod_v01/saved/searches/apisearchv3/history&lt;/A&gt;"&lt;/P&gt;
&lt;P&gt;Into a PowerShell equivalent:&lt;/P&gt;
&lt;P&gt;api.splunk.company.com:443 is not trusted, as it does not have an SSL cert.&lt;/P&gt;
&lt;P&gt;I've read many examples, I just want to export this saved search using invoke-restmethod&lt;/P&gt;
&lt;P&gt;Can anyone assist?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 20:29:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467352#M7518</guid>
      <dc:creator>vandelin</dc:creator>
      <dc:date>2020-06-08T20:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467353#M7519</link>
      <description>&lt;P&gt;In the end i want the history for the sid and then i want to call:&lt;BR /&gt;
curl --insecure -u username "&lt;A href="https://api.splunk.company.com:443/services/search/jobs/Enter"&gt;https://api.splunk.company.com:443/services/search/jobs/Enter&lt;/A&gt; sid/results?count=0"&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 16:43:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467353#M7519</guid>
      <dc:creator>vandelin</dc:creator>
      <dc:date>2020-05-29T16:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467354#M7520</link>
      <description>&lt;P&gt;If you use powershell version 6 then you can add &lt;CODE&gt;-SkipCertificateCheck&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 16:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467354#M7520</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-29T16:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467355#M7521</link>
      <description>&lt;P&gt;I appreciate the response.&lt;/P&gt;

&lt;P&gt;I just can't seem to get the entire invoke-restmethod command down pat&lt;/P&gt;

&lt;P&gt;I can work with the cert issue , i see where you can search splunk with invoke-restmethod.&lt;/P&gt;

&lt;P&gt;I want to be able to have powershell invoke-restmethod and export a saved search&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 17:52:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467355#M7521</guid>
      <dc:creator>vandelin</dc:creator>
      <dc:date>2020-05-29T17:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467356#M7522</link>
      <description>&lt;P&gt;If you don't have powershell 6 then there are other ways to avoid checking certificates.  Google can help find them.&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 18:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467356#M7522</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-05-29T18:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467357#M7523</link>
      <description>&lt;P&gt;i was just mentioning that my curl command had   --insecure because it will throw ssl errors at you and not run if you dont because the site is not trusted/has an ssl cert&lt;/P&gt;

&lt;P&gt;Skipping certs is just one line that I already have &lt;/P&gt;

&lt;P&gt;[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }&lt;/P&gt;

&lt;P&gt;But I'm to form the entire 10 other lines, i cant find a good example to work with when exporting a saved search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$search=""https://api.splunk.company.com:443/services/search/jobs/scheduler__username_c3NlX3NpdGVzY29wZV9wcm9kX3YwMQ__usernameapisearchv3_at_1590751800_36332_8CEC1426-6D01-4FD1-8F3C-31B0C726D471/results?count=0" &amp;lt;-- im trying to do something like this 

#$search = $servar # Cmdlet handles urlencoding

       $body = @{

       search = $search

       output_mode = "json"

       earliest_time = "-31d"

       latest_time = "-5d"

       }

       Invoke-RestMethod -Method get -Uri $url -Credential $cred -Body $body
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 18:45:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467357#M7523</guid>
      <dc:creator>vandelin</dc:creator>
      <dc:date>2020-05-29T18:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use PowerShell to export a saved search using invoke-restmethod?</title>
      <link>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467358#M7524</link>
      <description>&lt;P&gt;I don't know why it formatted it like this, but, it is what it is&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 18:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/How-to-use-PowerShell-to-export-a-saved-search-using-invoke/m-p/467358#M7524</guid>
      <dc:creator>vandelin</dc:creator>
      <dc:date>2020-05-29T18:46:38Z</dc:date>
    </item>
  </channel>
</rss>

