- teams: harden Classic Teams removal, protect New Teams, and clean HKU run keys - dotnet: add bootstrapper EXE uninstall support and remove orphaned 3.1.* folders - teams: add MSIX package targeting and version parsing for vulnerable New Teams builds - m365: improve Graph SDK export speed, reuse sessions, and add null-safe handling
40 lines
1.5 KiB
PowerShell
Executable File
40 lines
1.5 KiB
PowerShell
Executable File
#Requires -RunAsAdministrator
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Enrolls the endpoint into Microsoft Intune / MDM.
|
|
.DESCRIPTION
|
|
Triggers the Windows auto-enrollment process via deviceenroller.exe.
|
|
Intended for company-owned endpoints.
|
|
#>
|
|
|
|
# Prompt for confirmation (case-insensitive)
|
|
Write-Host "WARNING: This script will enroll the current device into MDM." -ForegroundColor Red
|
|
Write-Host "This is meant for company-owned devices only." -ForegroundColor Red
|
|
$answer = Read-Host "Do you want to continue? (Y/N)"
|
|
|
|
if ($answer -notmatch '^[Yy](es)?$') {
|
|
Write-Host "Exiting script — Device will not be enrolled into MDM." -ForegroundColor Yellow
|
|
exit 0
|
|
}
|
|
|
|
Write-Host "Triggering Intune MDM enrollment..." -ForegroundColor Cyan
|
|
|
|
try {
|
|
# Launch deviceenroller and wait for command trigger completion
|
|
$process = Start-Process -FilePath "$env:SystemRoot\System32\deviceenroller.exe" `
|
|
-ArgumentList "/c /AutoEnrollMDM" `
|
|
-Wait `
|
|
-PassThru `
|
|
-NoNewWindow
|
|
|
|
if ($process.ExitCode -eq 0) {
|
|
Write-Host "MDM AutoEnrollment command initiated successfully." -ForegroundColor Green
|
|
Write-Host "Note: Enrollment processing occurs asynchronously in the background." -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "deviceenroller.exe exited with code: $($process.ExitCode)" -ForegroundColor Red
|
|
}
|
|
} catch {
|
|
Write-Host "Failed to launch deviceenroller.exe: $_" -ForegroundColor Red
|
|
exit 1
|
|
} |