Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Get-eventlog

Closed Thread
 
Thread Tools Display Modes
Old 06-08-2007   #1 (permalink)
Guy Thomas
Guest


 

Get-eventlog

I have checked help get-eventlog, and can find no reference to a -computer
or -computerName parameter.

Question:
Is there any way that PowerShell can interrogate the Eventlogs on another
machine?

Guy


Old 06-08-2007   #2 (permalink)
Brandon Shell
Guest


 

Re: Get-eventlog

You can use System.Diagnostics.EventLog
http://msdn2.microsoft.com/en-us/lib...og(VS.71).aspx
Example:
$log = "Application"
$server = "server1"
$evtlog = New-Object System.Diagnostics.Eventlog($log,$server)
$evtlog.Entries | select -first 10


"Guy Thomas" <guy@computerperformance.co.uk> wrote in message
news:uPHIT%23dqHHA.4768@TK2MSFTNGP02.phx.gbl...
>I have checked help get-eventlog, and can find no reference to a -computer
>or -computerName parameter.
>
> Question:
> Is there any way that PowerShell can interrogate the Eventlogs on another
> machine?
>
> Guy
>


Old 06-08-2007   #3 (permalink)
Brandon Shell
Guest


 

Re: Get-eventlog

I also did a search using: http://bsonposh.com/modules/wordpress/?page_id=13
(Google Blog Search I created)

Found some WMI examples as well:
http://blog.sapien.com/current/2006/...filtering.html
http://thepowershellguy.com/blogs/po...fic-words.aspx

There are numerous others as well.

"Guy Thomas" <guy@computerperformance.co.uk> wrote in message
news:uPHIT%23dqHHA.4768@TK2MSFTNGP02.phx.gbl...
>I have checked help get-eventlog, and can find no reference to a -computer
>or -computerName parameter.
>
> Question:
> Is there any way that PowerShell can interrogate the Eventlogs on another
> machine?
>
> Guy
>


Old 06-08-2007   #4 (permalink)
Guy Thomas
Guest


 

Re: Get-eventlog

Fantastic!

Another magic scripting moment - Thank you Brandon.

This is the example that I am modifying for my needs.

http://blog.sapien.com/current/2006/...filtering.html

I keep forgetting about the Select .. -query constructions.

What I never forget is the gulf between my clunky amateur efforts and the
elegance and efficiency of what you Professionals can achieve.

Guy







"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:enQqvzeqHHA.3228@TK2MSFTNGP03.phx.gbl...
>I also did a search using:
>http://bsonposh.com/modules/wordpress/?page_id=13 (Google Blog Search I
>created)
>
> Found some WMI examples as well:
> http://blog.sapien.com/current/2006/...filtering.html
> http://thepowershellguy.com/blogs/po...fic-words.aspx
>
> There are numerous others as well.
>
> "Guy Thomas" <guy@computerperformance.co.uk> wrote in message
> news:uPHIT%23dqHHA.4768@TK2MSFTNGP02.phx.gbl...
>>I have checked help get-eventlog, and can find no reference to a -computer
>>or -computerName parameter.
>>
>> Question:
>> Is there any way that PowerShell can interrogate the Eventlogs on another
>> machine?
>>
>> Guy
>>

>



Old 06-11-2007   #5 (permalink)
Jeffery Hicks
Guest


 

Re: Get-eventlog

Guy Thomas wrote:
> Fantastic!
>
> Another magic scripting moment - Thank you Brandon.
>
> This is the example that I am modifying for my needs.
>
> http://blog.sapien.com/current/2006/...filtering.html
>
> I keep forgetting about the Select .. -query constructions.
>
> What I never forget is the gulf between my clunky amateur efforts and the
> elegance and efficiency of what you Professionals can achieve.
>
> Guy
>
>
>
>
>
>
>
> "Brandon Shell" <tshell.mask@gmail.com> wrote in message
> news:enQqvzeqHHA.3228@TK2MSFTNGP03.phx.gbl...
>> I also did a search using:
>> http://bsonposh.com/modules/wordpress/?page_id=13 (Google Blog Search I
>> created)
>>
>> Found some WMI examples as well:
>> http://blog.sapien.com/current/2006/...filtering.html
>> http://thepowershellguy.com/blogs/po...fic-words.aspx
>>
>> There are numerous others as well.
>>
>> "Guy Thomas" <guy@computerperformance.co.uk> wrote in message
>> news:uPHIT%23dqHHA.4768@TK2MSFTNGP02.phx.gbl...
>>> I have checked help get-eventlog, and can find no reference to a -computer
>>> or -computerName parameter.
>>>
>>> Question:
>>> Is there any way that PowerShell can interrogate the Eventlogs on another
>>> machine?
>>>
>>> Guy
>>>

>
>

It's too bad the current version of Get-Eventlog doesn't support a
remote computer, without resorting to some .NET hacking. But that's
where WMI comes in which is why I wrote the blog entries. I'm glad you
found them helpful.

--
Jeffery Hicks
SAPIEN Technologies - Scripting, Simplified.

blog: http://blog.SAPIEN.com
Community: http://www.scriptinganswers.com
Training: http://www.ScriptingTraining.com
Books: http://www.SAPIENPress.com
Editor: http://www.primalscript.com
Tools: http://www.scriptingoutpost.com

"Those who forget to script it are doomed to repeat it."

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Security EventLog floyd VB Script 0 2 Weeks Ago 11:39 AM
question to get-eventlog André PowerShell 16 01-18-2008 04:47 AM
How to add new records to EventLog? David Kriz PowerShell 2 01-12-2008 03:47 AM
can't access XP eventlog - why Andy W. Vista security 0 06-12-2007 01:11 AM
get eventlog remote and newest Sanders PowerShell 6 02-15-2007 09:36 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50