• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Calling Methods on ? pipes

F

fixitchris

#1
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 Computer

A

Adam Milazzo

#2
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 Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)