Avatar of nhhgict
nhhgict asked on

Event Log exports...

Is it possible to save a powershell script that I can then run under "Scheduled Tasks" which will use the Get-EventLog command to export the specific EvenLog to .csv

I want a user to be able to see the an apllication specific event log on a sever but don't want them to have Admin rights which are required to view the logs via MMC.
Windows Server 2003

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Yes, just put save your script


And setup a scheduled task using the following format:

"C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe" -command "C:\Jobs\ExtractEvents.ps1"

Start in:

Something similar to the above should get you what you are needing.

Krzysztof Pytko


try to use this syntax

powershell -command "& 'script_name.ps1' "

add it to Task Scheduler


Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

Thanks for your help everyone...

I'm a total powershell noob...the trouble I'm having is not with the task but with the PS syntax for the script particularly I'm not clued up on how to order powershell commands nor the required parameters after the Get-EventLog command...

This is probably totally wrong but I'm trying this from what I've found in the help files...I want to simply get it to dump the the event log named "Compleat" to CompleatLog.csv in the location specifed...

Get-EventLog Compleat ¦ Export-CSV "E:\CompleatLogs\CompleatLog.csv"

It throws out an error..."Input string was not in a correct format."

This would depend on which log, but you can use

Get-EventLog -logName System | Export-Csv "E:\CompleteLogs\CompleteLog.csv"


Get-Help Get-EventLog -detailed

for more information on using the cmdlet.

This VB script edited to include the filename and server for my environment has worked...

Thanks very much.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.