Run all Outlook rules as a scheduled task

Outlook is processing Junk mail rules before custom rules and several messages do not get moved to the inbox.  Would like to schedule Outlook rules to run as a task using a VB script that moves items from Junk folder to Inbox based on the rule I created.  Found a webpage that has a vbscript on this but not an experience scripter.  Anyone have a script that can do this?

Also, found this Expert script but nothing is moved when I run it.  Only get a dialog saying which rules were executed against the inbox.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skinneeJ, rules are executed in order they are created, you can re-order your rules to suit your needs thus avoiding having to mess around with the vbscript solution.  Could re-ordering your rules fix your issues?
skinneeJAuthor Commented:
dlancelot, in my case the rule is at the very top but Outlook will occastionally override my rule when the message arrives.  If I run the rule manually after the message is in Junk folder it gets moved to the inbox . I would expect it to work the same way when messages arrive, but this is not happening.

We also have other users who have this same problem with rules they've created and need some sort of workaround since we cannot turn off Outlooks Junk filter.
I have noticed this myself, what I have done is when creating or editing the rule, make sure on the second page of rule options, you check off the "stop processing more rules" option.  This fixed my issue
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

skinneeJAuthor Commented:
I tried checking the "stop processing more rules" option and msgs are still going to Junk folder.  Here's my rule:

Apply this rule after the message arrives
with 'New Ticket' or 'New Client Reply' or 'New Staff Reply' in the subject
move it to the Inbox folder
  and stop processing more rules
Is the email controlled by the exchange server?  I'm wondering if it's not outlook marking it as junk...
skinneeJAuthor Commented:
Outlook is marking it as junk.
David LeeCommented:
Hi, skinneej.

Sorry, but I'm a little confused.  How will running all the rules via a scheduled task fix the problem of the junk mail filter putting items in junk mail that don't belong there?
skinneeJAuthor Commented:
Because Outlook is processing the Junk mail rules before applying my custom rules.  If I go into Rules and Alerts and Run Rules Now the messages will be moved to the inbox.
David LeeCommented:
So when you run the rules manually you are selecting the option to run them against a folder other than the inbox.  Correct?  If not, then I'm not understanding how you're getting the items out of the junk items folder.
skinneeJAuthor Commented:
BlueDevilFan, Yes I'm running the rules manually against the Junk folder.
David LeeCommented:
Got it.  Is that the folder you want to run them against if you can run rules via a scheduled task?
skinneeJAuthor Commented:
Yes it is.
David LeeCommented:
Ok, this should do it.  Here's the code.  Follow these instructions to use it.

1.  Open Notepad
2.  Copy the code below and paste it into Notepad
3.  Edit the script per the comments I included in it
4.  Save the file with a .vbs extension
5.  Test the script by double-clicking on the vbs file
6.  Create a scheduled task for running the script.  Note that you must be logged in with Outlook open and running for the script to work.  If Outlook is not running, then the script won't do anything.
'Change the following three constants as desired
Const olFolderJunk = 23

Dim olkApp, olkFld, olkRul
On Error Resume Next
Set olkApp = GetObject(,"Outlook.Application")
If TypeName(OlkApp) = "Application" Then
    Set olkFld = olkApp.Session.GetDefaultFolder(olFolderJunk)
    For Each olkRul In olkApp.Session.DefaultStore.GetRules
End If
Set olkRul = Nothing
Set olkFld = Nothing
Set olkApp = Nothing

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
skinneeJAuthor Commented:
This is exactly what I was looking for.
David LeeCommented:
Cool.  Glad I could help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.