locked
How do you know what unit of measure a property is when it returns a result RRS feed

  • Question

  • How do I know what units of measure a property of an object returns.  If it is a measure of memory, is it in KB, MB, GB or if it is a measure of time is it in seconds, minutes, days.

    For example, when I run... 

    get-Process | Get-Member

    ...I don't see an unit of measure associated with the properties.

    There is probably an easy answer to this but it is escaping me right now.





    • Edited by OtherID Tuesday, October 2, 2018 8:55 PM
    Monday, October 1, 2018 9:54 PM

Answers

  • Usually memory is in bytes (really integer), and time is a [datetime] object with many properties (day, hour, minute, second, ticks, etc).  You can run gettype() on any variable, like "$a.gettype()".

    • Edited by JS2010 Tuesday, October 2, 2018 6:55 PM
    • Marked as answer by OtherID Tuesday, October 2, 2018 8:39 PM
    Tuesday, October 2, 2018 6:52 PM

All replies

  • Get-Member tells you what type the property is.  Int, Long, string, …

    What property are you having an issue with?

    Most properties are absolute values and not KB, GB or  other.


    \_(ツ)_/

    Monday, October 1, 2018 10:05 PM
  • It's more of a general question.  If I'm looking at the value of a property, how do I know if it is giving it to me in KB vs. MB, or Seconds Vs. Minutes?
    Tuesday, October 2, 2018 3:44 AM
  • What property?  Most properties are in bytes.  Without a clear idea of what you are asking there is no possible answer.


    \_(ツ)_/

    Tuesday, October 2, 2018 3:55 AM
  • That's my point.  It depends on the object and it depends on the specific property.  Where are these things documented? per cmdlet, per object, per property.

    Tuesday, October 2, 2018 6:47 PM
  • Usually memory is in bytes (really integer), and time is a [datetime] object with many properties (day, hour, minute, second, ticks, etc).  You can run gettype() on any variable, like "$a.gettype()".

    • Edited by JS2010 Tuesday, October 2, 2018 6:55 PM
    • Marked as answer by OtherID Tuesday, October 2, 2018 8:39 PM
    Tuesday, October 2, 2018 6:52 PM
  • The objects in Net are self-documenting.   That is the purpose of "Get-Member".  This gives you the information about the members and the object.

    For many object we can do this:

    PS D:\scripts> get-service spooler | gm
    
    
       TypeName: System.ServiceProcess.ServiceController
    
    Name                      MemberType    Definition
    ----                      ----------    ----------
    Name                      AliasProperty Name = ServiceName
    RequiredServices          AliasProperty RequiredServices = ServicesDependedOn

    Take the typeName and paste it into your search engine to find th eobject documentation which is here:

    https://docs.microsoft.com/en-us/dotnet/api/system.serviceprocess.servicecontroller?view=netframework-4.7.2

    Also note that the GM info has a "Definition"  column which gives more detailed info.


    \_(ツ)_/


    • Edited by jrv Tuesday, October 2, 2018 6:54 PM
    Tuesday, October 2, 2018 6:53 PM
  • Usually memory is in bytes (really integer), and time is a [datetime] object with many properties.

    Usually memory is in a "long" or "Int" which is the "integer" expressed as an int or a long number of bytes.

    PagedMemorySize            Property       int PagedMemorySize {get;}
    PagedMemorySize64          Property       long PagedMemorySize64 {get;}
    PagedSystemMemorySize      Property       int PagedSystemMemorySize {get;}
    PagedSystemMemorySize64    Property       long PagedSystemMemorySize64 {get;}
    PeakPagedMemorySize        Property       int PeakPagedMemorySize {get;}
    PeakPagedMemorySize64      Property       long PeakPagedMemorySize64 {get;}
    PeakVirtualMemorySize      Property       int PeakVirtualMemorySize {get;}


    \_(ツ)_/

    Tuesday, October 2, 2018 6:58 PM
  • I didn't know about gettype().  Thank you.  So by that I can see it exposes what .NET Module, assembly, etc it is and then I can probably look up the documentation on that on MSDN?  Is that correct?

    Thanks

    Tuesday, October 2, 2018 7:09 PM
  • I think that points me more in the right direction.  Thanks for the information.  I'll do some more research.

    Thanks

    Tuesday, October 2, 2018 7:11 PM
  • That's my point.  It depends on the object and it depends on the specific property.  Where are these things documented? per cmdlet, per object, per property.

    I will also note that many things like how memeory is measured are basic computer engineering issues.  Memory on all systems is always measured in bytes unless otherwise specified.

    This is one reason I push people wanting to be techs to spend the time to learn computer engineering and to learn OS design and engineering.  THese things are not directly documented when we document systems.  They are assumed since we assume the documentation is being written for trained techs (engineers) and not for end users.

    This also goes for most other fundamental measurements in all system.  Disks are measured in bytes but can be listed as sectors or blocks.  When a number is other than bytes the property will be named accordingly.

    Memory properties are also named accordingly as you can see. "Paged", "Pooled", "Peak"

    Once you have learned the basics of computer engineering this will all be obvious.

    Most "tech" are trained at either the "desktop tech" level or the "help desk" level.  This does not normally require other than  simple knowledge of the computer as most work is done from the GUI or via tools that break this out in less technical ways.  In Windows the "Administrator" function has little to d with the underlying technology o Admins are not required to know computer engineering.

    When we drop to a prompt and use WMI/CIM with PowerShell then the gloves come off. What we see is all the low level OS and hardware stuff.  Computer engineering knowledge is required.

    There are plenty of great books written to upgrade a desktop tech to a tech with good knowledge of the world of computer engineering without requiring a complete knowledge of the computer engineering that degreed engineers must learn.  I recommend getting one or more of these books an upgrading your knowledge.  For command line techs this re-education is also continuous as new technologies are added continuously. Once you are versed in the engineering it is possible to keep up by reading technology newsletters and  magazine articles.  Some technologies will still require hitting the books.

    The better large corporation send techs out to training in new subsystems but only after they have proven they are current in the basic engineering.  Many companies will only hire degreed engineers to work above the desktop tech and network tech level.


    \_(ツ)_/

    Tuesday, October 2, 2018 7:24 PM