A professional PowerShell application that automatically archives emails older than a specified number of days from your Outlook Inbox to organized year/month folders. Features beautiful UI/UX with ASCII art banners and professional styling.
Author: Ryan Zeffiretti
Version: 2.9.5
License: MIT
Outlook's built-in archiving feature creates local .pst files that are stored on your computer's hard drive. While this works for a single machine, it creates several critical limitations:
Archived emails are only available on the computer where they were archived. You can't access your archives from other computers with Outlook.
Because the archive is just another local Outlook data file, a hard-drive failure or profile corruption can render it inaccessible or lostβunless you've implemented a backup strategy for your PST files.
Local PST archives aren't part of Exchange or Microsoft 365 mailboxes. You can't open them from Outlook on a different PC or via Outlook on the webβonly from the Outlook profile where they're attached.
AutoArchive preserves whatever folder hierarchy you had in your mailbox, but it doesn't auto-generate year/month folders. All "archived" items go into the PST's existing folder tree (or the default Archive folder), not into a neat calendar-based folder structure.
Outlook Auto Archive solves these problems by:
- βοΈ Cloud-Based Archiving: Moves emails to your existing Outlook folders that sync across all your devices
- π± Multi-Device Access: Access your archived emails from any computer with Outlook installed
- π Organized Structure: Creates clean year/month folder hierarchies (e.g.,
Archive\2025\2025-08) - π Automatic Sync: Leverages your existing Outlook sync to make archives available everywhere
- β‘ Lightweight: No additional storage or complex setup required
- π‘οΈ Data Safety: Uses your existing cloud backup and sync infrastructure
- π§Ή Clean Inbox: Automatically moves old emails out of your inbox to keep it organized and clutter-free
- Exchange Online Archive: A server-side archive mailbox that syncs across devices (requires Microsoft 365)
- Third-Party Tools: Solutions like Clean Email can auto-archive into structured folders or cloud storage
- Manual PST Management: You can create separate PSTs per year/month yourself, but it's a manual process
- π’ Business Users who need access to archived emails across multiple workstations
- π Home Users with multiple computers who want consistent email access
- π± Remote Workers who switch between office and home computers
- πΌ Anyone who wants better organized email archives that sync automatically
- π‘οΈ Data-Conscious Users who want to avoid local PST file risks
- π¨ Beautiful User Interface: Professional ASCII art banners and color-coded sections
- π§ Automatic Email Archiving: Moves emails older than X days from Inbox to Archive folders
- π Organized Structure: Creates year/month folder hierarchy (e.g.,
Archive\2025\2025-08) - π‘οΈ Dry-Run Mode: Test the application safely without actually moving emails
- π Comprehensive Logging: Detailed logs of all operations with timestamps
- π₯ Multi-Account Support: Works with multiple Outlook accounts/stores
- π Smart Folder Detection: Automatically finds Archive folders in various locations
- π Duplicate Prevention: Handles duplicate emails intelligently
- βοΈ Custom Skip Rules: Built-in logic to skip specific emails (e.g., monitoring alerts)
- β Outlook Status Check: Automatically verifies Outlook is running before execution
- π οΈ Enhanced Error Handling: Improved logging and error recovery
- β° Windows Task Scheduler: Easy setup for automatic archiving
- π± Gmail Support: Works with Gmail accounts using custom labels
- π» Console Compatibility: ASCII-compatible display that works on all Windows systems
- π¨ Professional UI: Clean, readable interface with consistent styling across all terminals
- π‘οΈ Dry-Run Mode: Test without making changes
- π Duplicate Prevention: Avoids moving duplicate emails
- π οΈ Error Handling: Graceful handling of missing folders or permissions
- π Backup Logging: All operations are logged before execution
- π Windows Security: Automatic unblocking of downloaded executables
- Windows 10/11 with PowerShell 5.1 or later
- Microsoft Outlook (desktop app) installed and configured
- Outlook COM Interop permissions
The application automatically detects and attempts to unblock itself if Windows has blocked it due to being downloaded from the internet. This is a normal Windows security feature.
If automatic unblocking fails, you can manually unblock the executable:
- Right-click on
OutlookAutoArchive.exe - Select "Properties"
- Check the "Unblock" checkbox at the bottom of the dialog
- Click "OK"
- Run the application again
This is a one-time process - once unblocked, the file will run normally on subsequent executions.
The application uses ASCII-compatible characters instead of Unicode emojis to ensure proper display across all Windows console environments:
- β Consistent Display: All text indicators use ASCII characters that display correctly everywhere
- π₯οΈ Cross-Platform: Works on all Windows systems regardless of console encoding
- π― Professional Appearance: Clean, readable text indicators like
[OK],[ERROR],[TIP] - β‘ Better Performance: No Unicode rendering issues or display glitches
The application uses these ASCII-compatible indicators:
[OK]- Success messages and confirmations[ERROR]- Error messages and failures[!]- Warning messages and important notes[TIP]- Helpful tips and recommendations[EMAIL]- Email-related operations[FOLDER]- Folder operations[SCHEDULE]- Scheduling information[STATS]- Statistics and summaries
This ensures that all users see the same professional interface regardless of their Windows console configuration.
- Download
OutlookAutoArchive.exefrom the latest release - Double-click the executable to start the first-run setup
- Follow the guided setup to configure your preferences
- Test in dry-run mode to verify everything works
- Set up automatic scheduling using the included setup executable
The application automatically installs to C:\Users\[YourUsername]\OutlookAutoArchive on first run:
- β User-specific installation (no admin permissions required)
- β Easy to find and manage
- β Works with all Windows user types
- β Automatic configuration file creation
OutlookAutoArchive.exe- Main application (recommended for all users)OutlookAutoArchive.ps1- Main application script (included in source code packages)setup_task_scheduler.exe- Task scheduler setup executable (easy to use)setup_task_scheduler.ps1- Task scheduler setup script (included in source code packages)config.json- Configuration file (auto-created on first run)
Benefits of using the .exe files:
- β No PowerShell execution policy issues
- β Double-click to run - no command line needed
- β Works with Windows Task Scheduler out of the box
- β Automatic Windows security unblocking
- β Professional appearance with proper metadata
- β Easy for non-technical users
The application uses a config.json file for configuration. Edit this file to customize behavior:
{
"RetentionDays": 14,
"DryRun": true,
"LogPath": ".\\Logs",
"GmailLabel": "OutlookArchive",
"SkipRules": [
{
"Mailbox": "Your Mailbox Name",
"Subjects": ["Subject Pattern 1", "Subject Pattern 2"]
}
]
}RetentionDays: Number of days to keep emails in Inbox before archiving (default: 14)DryRun: Whentrue, shows what would be moved without actually moving emails (default: true)LogPath: Directory where log files are stored (supports%USERPROFILE%variable)GmailLabel: Custom Gmail label name for archive folder (default: "OutlookArchive")SkipRules: Array of rules to skip specific emails by mailbox and subject patterns
- π Connects to Outlook: Uses COM Interop to access Outlook
- π Finds Archive Folder: Searches for Archive folder in multiple locations:
Inbox\Archive- Root-level
Archive - Custom Gmail labels (configured via
GmailLabel)
- π Creates Folder Structure: Automatically creates year/month folders
- π§ Scans Inbox: Processes all emails in the Inbox
- π¦ Moves Old Emails: Moves emails older than retention period to appropriate archive folder
- π Logs Everything: Records all operations to timestamped log files
The application creates an organized folder structure:
Archive/
βββ 2025/
β βββ 2025-08/
β βββ 2025-07/
β βββ ...
βββ 2024/
β βββ 2024-12/
β βββ ...
- Double-click
OutlookAutoArchive.exe - Follow the guided setup to configure archive folders and scheduling
- Test in dry-run mode to verify everything works
- Review logs in the
Logsfolder - Set up automatic scheduling using the provided options
# Run the executable (uses config.json automatically)
.\OutlookAutoArchive.exeThe first-run setup offers daily scheduled archiving:
π‘ Design Philosophy: I have simplified the scheduling to focus on reliability and system performance. Unlike continuous monitoring solutions that stay in memory, this approach runs once per day and then completely unloads, ensuring your system remains responsive and efficient.
- Runs once per day at your chosen time (e.g., 2:00 AM)
- Perfect for users who want predictable, scheduled archiving
- Gracefully skips runs when Outlook is not available
- Simple and reliable scheduling option
- Memory efficient - application unloads after each run, keeping your system responsive
- Reliable performance - no background processes consuming system resources
Use setup_task_scheduler.exe to set up scheduling later:
# Run as Administrator
.\setup_task_scheduler.exeAlternative: Use Windows Task Scheduler directly:
- Open Task Scheduler (search in Start menu)
- Click Create Basic Task
- Name:
Outlook Auto Archive - Trigger: Daily at your preferred time
- Action: Start a program
- Program:
C:\Users\YourUsername\OutlookAutoArchive\OutlookAutoArchive.exe - Check Run with highest privileges
Logs are stored in: Logs\ folder within your installation directory
Each run creates a timestamped log file: ArchiveLog_YYYY-MM-DD_HH-mm-ss.txt
Log entries include:
- Configuration settings
- Folder creation operations
- Email movement details
- Errors and warnings
- Completion timestamp
To skip specific emails, add rules to the config.json file:
"SkipRules": [
{
"Mailbox": "Your Mailbox Name",
"Subjects": [
"Subject Pattern 1",
"Subject Pattern 2"
]
}
]For Gmail accounts, the application uses custom labels instead of folders:
- Enable IMAP in Gmail settings
- Create a custom label (e.g., "OutlookArchive")
- Check "Show in IMAP" for the label
- Configure
GmailLabelin yourconfig.json
- "Access Denied" errors: Ensure Outlook is running and you have permissions
- No Archive folder found: The application will help you create one during setup
- Executable won't run:
- Windows may block downloaded files - the app will attempt to unblock automatically
- If automatic unblocking fails, right-click β Properties β Check "Unblock"
- Config file issues: The app will auto-create
config.jsonif missing - Scheduled task not running: Ensure Outlook is running when the task executes
Check the log files in the Logs folder for detailed error messages and operation history.
This project is open source and available under the MIT License "AS IS".
Author: Ryan Zeffiretti
ALWAYS BACKUP YOUR DATA BEFORE USE! While this application includes safety features like dry-run mode and comprehensive logging, it's your responsibility to ensure you have proper backups of your email data before using this tool.
This software is provided "AS IS" without warranty of any kind. The author makes no representations or warranties about the accuracy, reliability, completeness, or suitability of this software for any purpose.
By using this software, you acknowledge that:
- You have backed up your email data before use
- You understand the risks involved in email operations
- You accept full responsibility for any consequences
- You will test the software in dry-run mode first
If you encounter issues:
- Check the log files for detailed error messages
- Ensure Outlook is properly configured
- Verify you have necessary permissions
- Test with dry-run mode enabled
- Review the troubleshooting section above
Note: This application is designed for personal use and should be tested thoroughly in your environment before production use. Version 2.9.5 includes enhanced UI/UX with beautiful styling, professional interface design, and improved console compatibility.