Calling Methods on ? pipes


  1.    06 Dec 2006 #1
    fixitchris Guest

    Calling Methods on ? pipes


    My brain is frozen....

    How can i call the .get_username() method on the piped $_?

    Get-EventLog -LogName security | ? { $_.eventid -eq 627 }

    and how can i pipe that username to ADD-content cmdlet?
    Thank you
      My System SpecsSystem Spec

  2.    06 Dec 2006 #2
    Adam Milazzo Guest

    Re: Calling Methods on ? pipes


    fixitchris wrote:
    > My brain is frozen....
    >
    > How can i call the .get_username() method on the piped $_?
    >
    > Get-EventLog -LogName security | ? { $_.eventid -eq 627 }
    >
    > and how can i pipe that username to ADD-content cmdlet?
    > Thank you


    Get-EventLog -LogName security | ? { $_.eventid -eq 627 } | % {
    $_.get_username() } | add-content ...

    ?
      My System SpecsSystem Spec

Calling Methods on ? pipes

Similar Threads
Thread Forum
Extension Methods for WPF Window
I am trying to add extension methods for the WPF Window type. namespace WpfSettingsApp { public static class WindowExtensions { public static...
.NET General
get help on methods and properties
hi, if i do a get-childitem | get-member i get all methods and properties for the cmlet. great! 1) how do i get help for a method to find out...
PowerShell
Calling methods on DataContracts
Hi, I have this requirement that a web service be used to return an object that the client can call methods on. For e.g: WebServiceClient c =...
Indigo
Win32_NetworkAdapterConfiguration methods and properties
http://lantoolbox.com/network-administration/articles/performing-networking-tasks-managing-dhcp-from-powershell/
PowerShell
static methods
I have a DLL with two methods one static and one not. public static int Test1(int p) { return 1; } public int Test2(int p) { return 2;} I use...
PowerShell
Calling base methods BeginProcessing, EndProcessing, ProcessRecord
A few web tutorials presenting custom CmdLets are calling the base methods BeginProcessing, EndProcessing, ProcessRecord. But are those calls really...
PowerShell
Output Methods
Hi Are there any output or format methods that are not "talking" that much? Example 1: get-childitem 'C:\Program Files' -include excel*...
PowerShell

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 07:33.
    .