<?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: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273977#M31895</link>
    <description>&lt;P&gt;I think the problem is with your Format-List.&lt;BR /&gt;
Try using a Select-Object instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Get-WmiObject -Class Win32_Product | Select-Object Name, InstallDate, InstallLocation, PackageCache, Vendor, Version, IdentifyingNum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 16 Dec 2015 15:09:31 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2015-12-16T15:09:31Z</dc:date>
    <item>
      <title>Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273976#M31894</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;

&lt;P&gt;I am having problems integrating the Splunk Add-on for Microsoft Powershell. My goal is that I want to run a process that collects machine data once a day at a specific time across all my systems, then feed the data to a dashboard for reporting. I've tried the Splunk_TA_Windows installedapps.bat file, but that does not collect the right information. I also tried WinHOSTMon which does get the data, but has a field extraction issue with the DisplayName field, and further has been deprecated as of 6.3. I am now using Powershell and am having problems.&lt;/P&gt;

&lt;P&gt;Below is my input syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# this should run every 5 minutes for testing and QC of the dashboard.
[powershell://installedapps]
script = . "$SplunkHome\etc\apps\Splunk_TA_windows\bin\installedapps.ps1"
index = windows
interval = 0 /5 * ? * ? *
sourcetype = powershell:installedapps
disabled = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The input runs the following powershell command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Get-WmiObject -Class Win32_Product | Format-List -Property Name,InstallDate,InstallLocation,PackageCache,Vendor,Version,IdentifyingNum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The results are not being populated in my index. I'm getting GUID's and the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;formatEntryInfo="Microsoft.PowerShell.Commands.Internal.Format.ListViewEntry"
outOfBand="False"
writeErrorStream="False"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;

&lt;P&gt;Thanks in advance for any help or suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273976#M31894</guid>
      <dc:creator>andrewbeeber</dc:creator>
      <dc:date>2020-09-29T08:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273977#M31895</link>
      <description>&lt;P&gt;I think the problem is with your Format-List.&lt;BR /&gt;
Try using a Select-Object instead&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Get-WmiObject -Class Win32_Product | Select-Object Name, InstallDate, InstallLocation, PackageCache, Vendor, Version, IdentifyingNum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Dec 2015 15:09:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273977#M31895</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-16T15:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273978#M31896</link>
      <description>&lt;P&gt;Also, given how small your script is, is there any reason you don't want to include that straight in the inputs file, that is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[powershell://installedapps]
script = Get-WmiObject -Class Win32_Product | Select-Object Name, InstallDate, InstallLocation, PackageCache, Vendor, Version, IdentifyingNum
index = windows
interval = 0 /5 ? ? *
sourcetype = powershell:installedapps
disabled = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Dec 2015 15:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273978#M31896</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-16T15:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273979#M31897</link>
      <description>&lt;P&gt;Thanks Javiergn, &lt;/P&gt;

&lt;P&gt;That worked! I'm not a big powershell user, so I appreciate the help.&lt;/P&gt;

&lt;P&gt;And to your second point. No. I had tried both, but with your feedback will revert to the configuration outlined in your follow up post.&lt;/P&gt;

&lt;P&gt;Many thanks!&lt;/P&gt;

&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 15:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273979#M31897</guid>
      <dc:creator>andrewbeeber</dc:creator>
      <dc:date>2015-12-16T15:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273980#M31898</link>
      <description>&lt;P&gt;In this example - what is the purpose of using the question mark instead of the asterisk in the interval definition ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;interval = 0 /5 ? ? *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Secondly, the inputs.conf.spec says this should be declared with a "schedule"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;schedule = &amp;lt;schedule&amp;gt;
*A cron schedule for executing the script. If blank, the script will only execute once.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does that mean that "interval" and "schedule" can be used interchangeably for the powershell input stanza type ?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 14:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273980#M31898</guid>
      <dc:creator>gavsdavs_GR</dc:creator>
      <dc:date>2015-12-17T14:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273981#M31899</link>
      <description>&lt;P&gt;Thanks for starting this thread.  I have also been thinking about implementing this along with some other queries.&lt;/P&gt;

&lt;P&gt;May I add some suggestions&lt;BR /&gt;
 1. Don't use &lt;CODE&gt;Get-WmiObject -Class Win32_Product&lt;/CODE&gt; as it will generate hundreds of events (1035) in the application log.&lt;BR /&gt;
 2. The query does not return all the installed software on a 64bit system.&lt;/P&gt;

&lt;P&gt;Below is some PowerShell code that does not generate 1035 events and gets 64&amp;amp;32bit programs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$s64=Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*
$s32=Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
$s = $s32+$s64
$applist = $s | Where-Object {$_.DisplayName -ne $Null}`
    | Where-Object {$_.DisplayName -like "*$Software*"} | Sort-Object DisplayName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Make Key Value Pairs for easy processing in Splunk by adding the following.  We used this in our .ps1 files.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;foreach ($app in $applist) {
$s= " DisplayName=`""+$app.DisplayName+"`"" `
+" Publisher=`""+$app.Publisher+"`"" `
+" DisplayVersion=`""+$app.DisplayVersion+"`"" `
+" InstallDate=`""+$app.InstallDate+"`""
Write-Host $s
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2015 15:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273981#M31899</guid>
      <dc:creator>kent_farries</dc:creator>
      <dc:date>2015-12-17T15:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Add-on for Microsoft PowerShell: How to run a process that collects machine data once a day at a specified time across all my systems?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273982#M31900</link>
      <description>&lt;P&gt;Just a minor comment to your post above. Either escape the backslashes or include the code within a code sample block&lt;/P&gt;</description>
      <pubDate>Thu, 17 Dec 2015 16:27:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Add-on-for-Microsoft-PowerShell-How-to-run-a-process-that/m-p/273982#M31900</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2015-12-17T16:27:30Z</dc:date>
    </item>
  </channel>
</rss>

