![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |