Results 1 to 3 of 3

Thread: Powershell script to parse system logs in text file

  1. #1
    SADIQ Guest

    Powershell script to parse system logs in text file

    I am new to Powershell and i want to create a script which will let me get all the system logs for my office server remotely into a text file or a file which i can open in notepad or similar text editor. Can anyone help me?

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Powershell script to parse system logs in text file

    You need this script :

    Code:
    PS> $syslog = get-wmiobject Win32_NTLogEvent -computername $server | where-object{$_.Logfile -match "System"}
    This will log all the system logs into text variable... I'm a noob too when it comes to Powershell.. so if any error please post back...

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Powershell script to parse system logs in text file

    Instead of it, i would suggest you to use a query based syntax :

    Code:
    PS> $query = "Select * from Win32_NTLogEvent Where LogFile='System' and
    Type='Error'"
    PS> $syslog = get-wmiobject -query $query -computername $server
    As it is fast.. All the best!

Similar Threads

  1. Running Powershell script with batch file with parameters?
    By Jaslein in forum Software Development
    Replies: 3
    Last Post: 12-01-2011, 03:36 AM
  2. Does java parse large text file
    By Zeverto in forum Software Development
    Replies: 3
    Last Post: 30-07-2009, 01:26 PM
  3. Batch Script Text file parse
    By tator.usenet@gmail.com in forum Windows Server Help
    Replies: 5
    Last Post: 25-03-2009, 02:12 AM
  4. Batch Script to parse lines in text file
    By jntoner1@gmail.com in forum Windows Server Help
    Replies: 8
    Last Post: 28-01-2009, 04:38 AM
  5. Changing File System Permissions and Ownership in Powershell
    By David Eisner in forum Windows Server Help
    Replies: 1
    Last Post: 21-10-2008, 10:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,545,155.96494 seconds with 17 queries