Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Why System.Diagnostics.EventLog needs an AliasProperty

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-09-2006   #1 (permalink)
dreeschkind
Guest


 

Why System.Diagnostics.EventLog needs an AliasProperty

I'm note sure if this only happens to me, but I consider things like this a
bummer:
The following table header suggests that the object has a property called
"Name" ...

PS> Get-EventLog -list

Max(K) Retain OverflowAction Entries Name
------ ------ -------------- ------- ----
512 0 OverwriteAsNeeded 1.337 Anwendung

.... but when I filter for it, I don't get the result that I would expect...

PS> Get-EventLog -list | where {$_.Name -like "An*"}
<nothing>

Ok, I'm not new to PowerShell, so I know how to handle situations like this:
Calling Get-EventLog -list | select -f 1 | fl * tells me that I should
use
"LogDisplayName" instead of "Name". And *surprise* it even works:

PS> Get-EventLog -list | where {$_.LogDisplayName -like "An*"}

Max(K) Retain OverflowAction Entries Name
------ ------ -------------- ------- ----
512 0 OverwriteAsNeeded 1.337 Anwendung

Ok, the experts might think that a few tweaks to the ETS (e.g. adding an
AliasProperty "Name" for "LogDisplayName") should be sufficient.
But if you ask me, this a general problem that will happen with all .Net
types that have a "bad View" defined. So I think that this should be fixed
somehow, or at least print it the following sentence in _BOLD_ into the
developer guide:

The "View" of an Object should only show table headers (properties) that
really exist for the "Type" or least always provide an AliasProperty for that
Type that has the same name as the table header.

--
greetings
dreeschkind

My System SpecsSystem Spec
Old 11-09-2006   #2 (permalink)
Marcel J. Ortiz [MSFT]
Guest


 

Re: Why System.Diagnostics.EventLog needs an AliasProperty

I think you're right. Its definitely confusing when that happens. Please
open bugs on this and any others you find so we can fix the ETS and
formatting files.

Thanks.
- Marcel


"dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
news:7AA2D424-4DDA-440A-9629-71AD8562CA16@microsoft.com...
> I'm note sure if this only happens to me, but I consider things like this
> a
> bummer:
> The following table header suggests that the object has a property called
> "Name" ...
>
> PS> Get-EventLog -list
>
> Max(K) Retain OverflowAction Entries Name
> ------ ------ -------------- ------- ----
> 512 0 OverwriteAsNeeded 1.337 Anwendung
>
> ... but when I filter for it, I don't get the result that I would
> expect...
>
> PS> Get-EventLog -list | where {$_.Name -like "An*"}
> <nothing>
>
> Ok, I'm not new to PowerShell, so I know how to handle situations like
> this:
> Calling Get-EventLog -list | select -f 1 | fl * tells me that I
> should
> use
> "LogDisplayName" instead of "Name". And *surprise* it even works:
>
> PS> Get-EventLog -list | where {$_.LogDisplayName -like "An*"}
>
> Max(K) Retain OverflowAction Entries Name
> ------ ------ -------------- ------- ----
> 512 0 OverwriteAsNeeded 1.337 Anwendung
>
> Ok, the experts might think that a few tweaks to the ETS (e.g. adding an
> AliasProperty "Name" for "LogDisplayName") should be sufficient.
> But if you ask me, this a general problem that will happen with all .Net
> types that have a "bad View" defined. So I think that this should be fixed
> somehow, or at least print it the following sentence in _BOLD_ into the
> developer guide:
>
> The "View" of an Object should only show table headers (properties) that
> really exist for the "Type" or least always provide an AliasProperty for
> that
> Type that has the same name as the table header.
>
> --
> greetings
> dreeschkind



My System SpecsSystem Spec
Old 11-13-2006   #3 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 

Re: Why System.Diagnostics.EventLog needs an AliasProperty

In the bug report, I STRONGLY suggest that the solution be some kind of
"forced tie" between the display name of the property and the actual
property name. One way would be disallowing anything not registered as a
property alias as a display name for the property; the other would be to
have the ETS automatically set the display name as an alias if it is not one
already.

Both techniques have problems, of course. One important issue here is that
there is a lot of benefit to having standardized property names across types
as exposed in PS, just as in cmdlet parameter names. A useful helper tool
would also be something that allows simple property name inspection - e.g.,
Get-PropertyName for types which would show a list of property names along
with associated display name and aliases.

"Marcel J. Ortiz [MSFT]" <mosoto@online.microsoft.com> wrote in message
news:ONygSfEBHHA.4672@TK2MSFTNGP02.phx.gbl...
>I think you're right. Its definitely confusing when that happens. Please
>open bugs on this and any others you find so we can fix the ETS and
>formatting files.
>
> Thanks.
> - Marcel
>
>
> "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
> news:7AA2D424-4DDA-440A-9629-71AD8562CA16@microsoft.com...
>> I'm note sure if this only happens to me, but I consider things like this
>> a
>> bummer:
>> The following table header suggests that the object has a property called
>> "Name" ...
>>
>> PS> Get-EventLog -list
>>
>> Max(K) Retain OverflowAction Entries Name
>> ------ ------ -------------- ------- ----
>> 512 0 OverwriteAsNeeded 1.337 Anwendung
>>
>> ... but when I filter for it, I don't get the result that I would
>> expect...
>>
>> PS> Get-EventLog -list | where {$_.Name -like "An*"}
>> <nothing>
>>
>> Ok, I'm not new to PowerShell, so I know how to handle situations like
>> this:
>> Calling Get-EventLog -list | select -f 1 | fl * tells me that I
>> should
>> use
>> "LogDisplayName" instead of "Name". And *surprise* it even works:
>>
>> PS> Get-EventLog -list | where {$_.LogDisplayName -like "An*"}
>>
>> Max(K) Retain OverflowAction Entries Name
>> ------ ------ -------------- ------- ----
>> 512 0 OverwriteAsNeeded 1.337 Anwendung
>>
>> Ok, the experts might think that a few tweaks to the ETS (e.g. adding an
>> AliasProperty "Name" for "LogDisplayName") should be sufficient.
>> But if you ask me, this a general problem that will happen with all .Net
>> types that have a "bad View" defined. So I think that this should be
>> fixed
>> somehow, or at least print it the following sentence in _BOLD_ into the
>> developer guide:
>>
>> The "View" of an Object should only show table headers (properties) that
>> really exist for the "Type" or least always provide an AliasProperty for
>> that
>> Type that has the same name as the table header.
>>
>> --
>> greetings
>> dreeschkind

>
>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Advanced System Diagnostics/Performance Reports for troubleshooting dmex General Discussion 1 08-25-2007 07:00 AM
Question about [System.Diagnostics.Process]::Start() andy@nodisabilities.com PowerShell 4 07-21-2007 03:20 AM
Wrap command shell in System.Diagnostics.Process Jon Davis PowerShell 10 04-17-2007 03:29 PM
Using .NET System.Diagnostics Marco Shaw PowerShell 1 11-01-2006 10:25 AM
Using ProcessStartInfo with [System.Diagnostics.Process]::Start Brandon Shell PowerShell 2 08-11-2006 07:07 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51