Search found 11054 matches

by jvierra
Thu Jul 20, 2017 12:21 pm
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 172

Re: Scheduled task parameter

This is how to get events by ID:

Get-WinEvent @{Logname='Application';ID=6101}

You method returns the whole event log every time. Using the filter selects only the ID wanted.

The "Message" is not available on events sent to a collector. In your case it is not needed.
by jvierra
Thu Jul 20, 2017 12:17 pm
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 172

Re: Scheduled task parameter

You have to reference the data elemt that contains the VM name.

Post the XML from one event and I will show you how to get it. We don't use string parsing with XML.
by jvierra
Thu Jul 20, 2017 8:07 am
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 172

Re: Scheduled task parameter

Here is a more complete example:

Code: Select all

$events = Get-WinEvent @{ LogName = 'application'; ID = 17137 } -MaxEvents 10 | ForEach-Object{ $_.ToXml() }
[xml]$xml = "<Events>$events</Events>"
$xml.Events.Event.System
$xml.Events.Event.EventData
by jvierra
Thu Jul 20, 2017 8:01 am
Forum: Windows PowerShell
Topic: Scheduled task parameter
Replies: 15
Views: 172

Re: Scheduled task parameter

To extract the xml you need to use "ToXml()" on each event. The easiest way is to do this.

[xml]$events = Get-WinEvent ... | %{$_.ToXml()

Now you can use the XML object to extract all properties.
by jvierra
Thu Jul 20, 2017 2:41 am
Forum: PowerShell GUIs
Topic: Combobox causes crash/freeze
Replies: 13
Views: 114

Re: Combobox causes crash/freeze

I have never had that happen. I suspect there is some other thing that is also interfering here. Unfortunately there is no way for me to reproduce this. You should look further and post what you find.
by jvierra
Thu Jul 20, 2017 2:26 am
Forum: PowerShell GUIs
Topic: Combobox causes crash/freeze
Replies: 13
Views: 114

Re: Combobox causes crash/freeze

Again I recommend that you use the debugger to see what is actually in the combobox. It sounds like you are loading it with dynamic objects that are trying to be deserilaized. At a prompt run the code and see what is actually being returned. Run just this line (and any connecting code) and inspect t...
by jvierra
Thu Jul 20, 2017 1:56 am
Forum: PowerShell GUIs
Topic: Combobox causes crash/freeze
Replies: 13
Views: 114

Re: Combobox causes crash/freeze

How many items in the ComboBox? If there are thousands it will be very slow and seem to freeze. What other code is attached to the combo?
by jvierra
Thu Jul 20, 2017 12:44 am
Forum: PowerShell GUIs
Topic: Combobox causes crash/freeze
Replies: 13
Views: 114

Re: Combobox causes crash/freeze

tvandenberghe@cochlear.com wrote:
Wed Jul 19, 2017 11:13 pm
In debug : no errors are shown.
But where does it hang?
by jvierra
Wed Jul 19, 2017 12:13 pm
Forum: Customer Service
Topic: Code formatter gone!
Replies: 4
Views: 174

Re: Code formatter gone!

The new style looks much better. It is cleaner and easier to read. The "code" tag is now retaining formatting but the font is too faded however, it is way better than nothing. $splat = @{ From = 'someone@abc.com' To = $recipients Subject = 'MSMQ Issue' Body = $body BodyAsHtml = $true Priority = 'Hig...
by jvierra
Wed Jul 19, 2017 9:23 am
Forum: PowerShell GUIs
Topic: Combobox causes crash/freeze
Replies: 13
Views: 114

Re: Combobox causes crash/freeze

Your code would be cleaner and faster if you do it like this: $button_DL_generateList_Click = { $lbl_DL_loading.Visible = $true $button_DL_generateList.Visible = $false #put all active groups in array so group can be choosen from dropdown $filter = {name -notlike 'security-*' -and name -notlike 'sec...