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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...