Posts

Showing posts from March, 2022

Outlook "Work Offline" Mode

 Since I've mainly only found this in terms of a VB Script. I'm going to post my version of it in PowerShell for anyone who is looking for something similar.  1: #Check if Outlook is online or offline mode 2: $Outlook = New-Object -ComObject Outlook.Application; 3: $State = if ($outlook.session.offline) {"Outlook has been set to work offline mode." } else { "Healthy - Outlook is in online mode." }; 4: $State; 5: 6: 7: #Toggle Outlook to online mode 8: Try { 9: $Outlook = New-Object -ComObject Outlook.Application 10: $State = "Toggle" 11: if ($outlook.session.offline) 12: { 13: $Outlook.ActiveExplorer().CommandBars.ExecuteMSO("ToggleOnline") 14: } 15: else 16: { 17: "Outlook already in online mode." 18: } 19: ConvertTo-Json($State) 20: } 21: Catch 22: { 23: If ($_.Exception.Message.Contains("Class not registered")) 2