Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -AssemblyName Microsoft.Office.Interop.Outlook
- $folders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
- $outlook = New-Object -ComObject Outlook.Application
- $mapi = $outlook.GetNameSpace("mapi")
- $tasks = $mapi.getDefaultFolder($folders::olFolderTasks)
- $currentTime = Get-Date
- foreach ($task in $tasks.Items) {
- if ($task.DueDate -lt $currentTime) {
- $task.Complete = true
- $task.Save()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement