<?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: Powershell Add-on Error - Unauthorized Access Error in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347023#M41907</link>
    <description>&lt;P&gt;I've also tried:&lt;BR /&gt;
interval = 60&lt;/P&gt;</description>
    <pubDate>Sun, 17 Dec 2017 15:32:33 GMT</pubDate>
    <dc:creator>chrismmckenna</dc:creator>
    <dc:date>2017-12-17T15:32:33Z</dc:date>
    <item>
      <title>Powershell Add-on Error - Unauthorized Access Error</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347021#M41905</link>
      <description>&lt;P&gt;I want to get the AWS instance id from a collection of hosts. I figured I’d create a powershell script to make a AWS introspection call to get the instance id. &lt;/P&gt;

&lt;P&gt;I’ve got the Splunk Add-on for Powershell (SA-ModularInput-PowerShell version 1.2.1) deployed. I’ve gone through the Powershell add-on documentation but I haven’t been able to get the Powershell script to work nor have I seen anything the directly address the errors I'm seeing in splunkd.log.&lt;/P&gt;

&lt;P&gt;Powershell version 3 is installed.&lt;/P&gt;

&lt;P&gt;This is getAWSInstanceId.ps1: (The output looks fine from the CLI)&lt;BR /&gt;
Set-ExecutionPolicy unrestricted -Force&lt;BR /&gt;
$webclient = new-object net.webclient&lt;BR /&gt;
$instanceid = $webclient.Downloadstring('&lt;A href="http://169.254.169.254/latest/meta-data/instance-id'" target="_blank"&gt;http://169.254.169.254/latest/meta-data/instance-id'&lt;/A&gt;)&lt;BR /&gt;
Write-Output "instanceid=$instanceid".tostring()&lt;/P&gt;

&lt;P&gt;Do  you have a simpler way to go about this? Otherwise, would you take a look at the following and possibly point out what I’m missing?&lt;/P&gt;

&lt;P&gt;This is the inputs.conf:&lt;BR /&gt;
[powershell://GETAWSINSTANCE]&lt;BR /&gt;
script = . "C:\Program Files\SplunkUniversalForwarder\etc\apps\SA-ModularInput-PowerShell\bin\getAWSInstanceId.ps1"&lt;BR /&gt;
schedule = 0 * * * * *&lt;BR /&gt;
index=customer_hosts&lt;BR /&gt;
sourcetype = aws:instanceid&lt;/P&gt;

&lt;P&gt;I’m seeing the following errors in splunkd.log and nothing forwarded&lt;/P&gt;

&lt;P&gt;12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" C:\Program Files\SplunkUniversalForwarder\bin\splunk-powershell.ps1 &lt;BR /&gt;
: File &lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" C:\Program Files\SplunkUniversalForwarder\bin\splunk-powershell.ps1 &lt;BR /&gt;
cannot be &lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" loaded because running scripts is disabled on this system. For more &lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" information, see about_Execution_Policies at &lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" &lt;A href="http://go.microsoft.com/fwlink/?LinkID=135170" target="_blank"&gt;http://go.microsoft.com/fwlink/?LinkID=135170&lt;/A&gt;.&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" At line:1 char:61&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" + &amp;amp; {get-content C:\Windows\TEMP\input510eb608e8b3d230.tmp | &lt;BR /&gt;
C:\Program` &lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" Files\Sp ...&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" +&lt;BR /&gt;&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe"" ~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe""     + CategoryInfo          : SecurityError: (:) [], &lt;BR /&gt;
PSSecurityException&lt;BR /&gt;
12-16-2017 19:30:55.434 -0800 ERROR ExecProcessor - message from ""C:\Program &lt;BR /&gt;
Files\SplunkUniversalForwarder\bin\splunk-powershell.exe""     + FullyQualifiedErrorId : UnauthorizedAccess&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:17:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347021#M41905</guid>
      <dc:creator>chrismmckenna</dc:creator>
      <dc:date>2020-09-29T17:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Add-on Error - Unauthorized Access Error</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347022#M41906</link>
      <description>&lt;P&gt;The UI is not displaying all of the asterisks, the schedule is in Quartz time and runs every minute&lt;/P&gt;

&lt;P&gt;schedule = 0 * * * * *&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 15:03:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347022#M41906</guid>
      <dc:creator>chrismmckenna</dc:creator>
      <dc:date>2017-12-17T15:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Add-on Error - Unauthorized Access Error</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347023#M41907</link>
      <description>&lt;P&gt;I've also tried:&lt;BR /&gt;
interval = 60&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 15:32:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347023#M41907</guid>
      <dc:creator>chrismmckenna</dc:creator>
      <dc:date>2017-12-17T15:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Add-on Error - Unauthorized Access Error</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347024#M41908</link>
      <description>&lt;P&gt;I kept trying different iterations and found the following works. I think the stanza name has to include Processes-&amp;lt;.\w+&amp;gt;&lt;/P&gt;

&lt;P&gt;inputs.conf:&lt;BR /&gt;
[powershell://Processes-getAWSInstanceId]&lt;BR /&gt;
script = . "C:\Program Files\SplunkUniversalForwarder\etc\apps\SA-ModularInput-PowerShell\bin\getAWSInstanceId.ps1"&lt;BR /&gt;
schedule = 0 5 1 ? * *&lt;BR /&gt;
index=enroute_customer_hosts&lt;BR /&gt;
sourcetype = aws:instanceid&lt;/P&gt;

&lt;P&gt;getAWSInstanceId.ps1:&lt;BR /&gt;
$webclient = new-object net.webclient&lt;BR /&gt;
$instanceid = $webclient.Downloadstring('&lt;A href="http://169.254.169.254/latest/meta-data/instance-id'" target="_blank"&gt;http://169.254.169.254/latest/meta-data/instance-id'&lt;/A&gt;)&lt;BR /&gt;
Write-Output "instanceid=$instanceid".tostring()&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:18:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347024#M41908</guid>
      <dc:creator>chrismmckenna</dc:creator>
      <dc:date>2020-09-29T17:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Add-on Error - Unauthorized Access Error</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347025#M41909</link>
      <description>&lt;P&gt;What exactly are you using that field for? It seems like something that might already be available as part of the AWS TA.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 20:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Powershell-Add-on-Error-Unauthorized-Access-Error/m-p/347025#M41909</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-12-18T20:55:13Z</dc:date>
    </item>
  </channel>
</rss>

