Splunk Search

Powershell vs WMI

jip31
Motivator

Hi

I an SPL command i use the Win32_DesktopMonitor WMI class and SPLUNK is able to use all the fields corresponding to this class
But i would prefer to do it with PowerShell but the script display any fiels (it works perfectly alone)
Find below what i have done :
COMMAND OR SCRIPT PATH
. "$SplunkHome\etc\apps\Splunk_TA_windows\bin\videosignal.ps1"
CRON
*/1 * * * *
SOURCETYPE
powershell:videosignal

POWERSHELL SCRIPT:
$strComputer = "."

$objWMi = get-wmiobject -computername localhost -Namespace root\CIMV2 -Query "Select * from Win32_DesktopMonitor"

foreach ($obj in $objWmi)
{
write-host "Availability:" $obj.Availability
write-host "Bandwidth:" $obj.Bandwidth
write-host "Caption:" $obj.Caption
write-host "ConfigManagerErrorCode:" $obj.ConfigManagerErrorCode
write-host "ConfigManagerUserConfig:" $obj.ConfigManagerUserConfig
write-host "CreationClassName:" $obj.CreationClassName
write-host "Description:" $obj.Description
write-host "DeviceID:" $obj.DeviceID
write-host "DisplayType:" $obj.DisplayType
write-host "ErrorCleared:" $obj.ErrorCleared
write-host "ErrorDescription:" $obj.ErrorDescription
write-host "InstallDate:" $obj.InstallDate
write-host "IsLocked:" $obj.IsLocked
write-host "LastErrorCode:" $obj.LastErrorCode
write-host "MonitorManufacturer:" $obj.MonitorManufacturer
write-host "MonitorType:" $obj.MonitorType
write-host "Name:" $obj.Name
write-host "PixelsPerXLogicalInch:" $obj.PixelsPerXLogicalInch
write-host "PixelsPerYLogicalInch:" $obj.PixelsPerYLogicalInch
write-host "PNPDeviceID:" $obj.PNPDeviceID
write-host "PowerManagementCapabilities:" $obj.PowerManagementCapabilities
write-host "PowerManagementSupported:" $obj.PowerManagementSupported
write-host "ScreenHeight:" $obj.ScreenHeight
write-host "ScreenWidth:" $obj.ScreenWidth
write-host "Status:" $obj.Status
write-host "StatusInfo:" $obj.StatusInfo
write-host "SystemCreationClassName:" $obj.SystemCreationClassName
write-host "SystemName:" $obj.SystemName
write-host
write-host "########"
write-host
}

Could you help me please??

Tags (1)
0 Karma

ansif
Motivator

Need clarification. The above powershell scripts is not working?

0 Karma
Get Updates on the Splunk Community!

Detecting Brute Force Account Takeover Fraud with Splunk

This article is the second in a three-part series exploring advanced fraud detection techniques using Splunk. ...

Buttercup Games: Further Dashboarding Techniques (Part 9)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Buttercup Games: Further Dashboarding Techniques (Part 8)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...