Worklet: Remove Microsoft Mail App from Managed laptops - Windows 10

<#
.SYNOPSIS
Check for presence of Microsoft Mail App on Managed laptops

.DESCRIPTION

Exits with 0 for compliance, 1 for Non-Compliance.
Non-Compliant devices will run Remediation Code at the Policy’s next scheduled date.

.NOTES
The Mail and Calendar apps help you stay up to date on your email, manage your schedule and stay in touch
with people you care about the most. Designed for both work and home, these apps help you communicate quickly
and focus on what’s important across all your accounts. Supports Office 365, Exchange, Outlook.com, Gmail,
Yahoo! and other popular accounts.

.LINK

#>

EVALUATION Code

$App = Get-AppxPackage Microsoft.windowscommunicationsapps | Select-Object Status

if ( $App -eq ‘NULL’ ) {
Exit 0
} else { Exit 1 }

REMEDIATION CODE

This code execution will REMOVE the MS Mail app from the managed laptop

Get-AppxPackage Microsoft.windowscommunicationsapps | Remove-AppxPackage

4 Likes