Eka
Eka

Reputation: 15002

Warning while executing powershell script

This is the continuation of this question i have asked in this SE How to run a PowerShell script from a batch file .I have used powershell to execute this command

$query = "SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2"
Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"}

I have succesfully executed the powersell script but i am getting this warning. enter image description here

Can you tell me how can i rectify this issue

Upvotes: 1

Views: 125

Answers (1)

Keith Hill
Keith Hill

Reputation: 202002

Pipe the command to Format-List or try Format-Table -Auto:

Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"} | Format-List

or

Register-WMIEvent -Query $query -Action { invoke-item "C:\Program Files\abc.exe"} | Format-Table -Auto

Upvotes: 2

Related Questions