about get-member issue

This topic contains 7 replies, has 4 voices, and was last updated by  April 1 year, 1 month ago.

  • Author
  • #69453


    I am a new learner for powershell , and I run into one problem , I run this command get-process |gm , and I find that in the member list , we have event , method , scriptsproperty ,propertyset ,anyone can help to share with some examples for them ? how to use them ?also how to read the definition .

    Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs)
    ErrorDataReceived Event System.Diagnostics.DataReceivedEventHandler ErrorDataReceived(System.Objec..
    Exited Event System.EventHandler Exited(System.Object, System.EventArgs)
    OutputDataReceived Event System.Diagnostics.DataReceivedEventHandler OutputDataReceived(System.Obje..
    BeginErrorReadLine Method void BeginErrorReadLine()
    BeginOutputReadLine Method void BeginOutputReadLine()
    CancelErrorRead Method void CancelErrorRead()
    CancelOutputRead Method void CancelOutputRead()
    Close Method void Close()
    CloseMainWindow Method bool CloseMainWindow()
    CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
    Dispose Method void Dispose(), void IDisposable.Dispose()
    Equals Method bool Equals(System.Object obj)
    GetHashCode Method int GetHashCode()
    GetLifetimeService Method System.Object GetLifetimeService()
    GetType Method type GetType()
    InitializeLifetimeService Method System.Object InitializeLifetimeService()
    Kill Method void Kill()
    Refresh Method void Refresh()
    Start Method bool Start()
    ToString Method string ToString()
    WaitForExit Method bool WaitForExit(int milliseconds), void WaitForExit()

    ration PropertySet PSConfiguration {Name, Id, PriorityClass, FileVersion}
    es PropertySet PSResources {Name, Id, Handlecount, WorkingSet, NonPagedMemorySize, PagedM...
    ScriptProperty System.Object Company {get=$this.Mainmodule.FileVersionInfo.CompanyName;}
    ScriptProperty System.Object CPU {get=$this.TotalProcessorTime.TotalSeconds;}
    on ScriptProperty System.Object Description {get=$this.Mainmodule.FileVersionInfo.FileDescri...
    on ScriptProperty System.Object FileVersion {get=$this.Mainmodule.FileVersionInfo.FileVersion;}
    ScriptProperty System.Object Path {get=$this.Mainmodule.FileName;}
    ScriptProperty System.Object Product {get=$this.Mainmodule.FileVersionInfo.ProductName;}
    rsion ScriptProperty System.Object ProductVersion {get=$this.Mainmodule.FileVersionInfo.Product...

  • #69456

    Adam Bertram

    Moving to correct forum.

    • #69513


      Adam , this is not correct forum for powershell question ?

  • #69462

    Albert van Boerum

    Hi April,

    I can suggest this free learning video from some great guys. If you are new to Powershell, the can help you to get the basics.



    • #69511


      thanks so much ,Albert , indeed ,i was learning powershell from the MS virtual academy ,hence i am confused by 'get-member'.

  • #69520

    Juliën Zweverink

    An couple of short examples:

    I am using Get-process as example.
    Get-Process | Get-Member

    To use the Kill Method

    (Get-Process -Name notepad).Kill()
    (Get-Process -Name notepad).WaitForExit()

    The Kill would have the same effect as the Stop-Process Cmdlet
    And the waitForExit the same as Wait-process Cmdlet

    To get just one Property or Script property you could use some what the some wat the approach only without the last () with are only for an Method.


    Also the Book 'PowerShell in an month of lunches' is a great book for learning all the basic of PowerShell.

    • #69637


      thanks so much , i just tried other method and property by following yours , it is very useful . i want to learn how to read those definition .

      for example , we have event here , how to read this and use it ?

    • #69640

      Disposed                   Event          System.EventHandler Disposed(System.Object, System.EventArgs)
      Exited                     Event          System.EventHandler Exited(System.Object, System.EventArgs)

You must be logged in to reply to this topic.