1

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

1
  • have you tried explicitly declaring which columns you want to display? Commented Oct 13, 2013 at 3:09

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

3 Comments

both query didn't work the job state is "not started"
You could also try resizing the console to 120 chars wide. :-)
i am extremely sorry but i am new to powershell and i dont understand by resizing the console? Using your above script i got this message i43.tinypic.com/23t087n.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.