Avatar of MSSC_support
MSSC_support
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Schedule an exchange shell task to clear log files

I have a exchange shell script that I run manually to clear out a bunch of log files that are created by exchange which eats up storage space on our environment.

Unfortunately, I cannot get this to work as a scheduled task as it keeps failing. Can anyone guide me to help automate this?
ExchangeWindows Server 2012Powershell

Avatar of undefined
Last Comment
MSSC_support

8/22/2022 - Mon
Colin McDonald

Can you provide details of the error received when running the scheduled task?

Can you provide screen shots of task settings
MSSC_support

ASKER
Ok.  At the moment I have it configured to run whether user is logged on or not and with highest privileges.

The program/script is set to:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

and argument:

-NonInteractive -WindowStyle Hidden -command ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; 'C:\Purge Logs\Purge-LogFiles keep 7 days.ps1'"

The error message i get is 0x0.

Hope this helps.
David Johnson, CD

a return of 0 normally means success, non zero means failure. Have you tried circular logging or getting an exchange aware backup
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
VB ITS

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
or
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.
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
MSSC_support

ASKER
This works but is slightly more risky.