Win32 Apps
Autopilot Branding (Cleanup) - [IHD]
Autopilot Branding by Michael Niehaus, with a cleanup-only configuration. During Windows Autopilot (OOBE) it removes consumer in-box apps, hides Widgets, blocks the Copilot app and Dev Home from being installed, removes OEM Edge bookmarks and the Edge desktop shortcut, and updates Edge and the in-box apps. It sets no wallpaper, theme, Start layout, OEM information, language, or time zone, and installs no apps. On a device that has completed OOBE it makes no change. Assign it as a required app that blocks the Enrollment Status Page.
Template details
- Category
- Win32 Apps
- Platform
- Windows
- Policy type
- Windows app (Win32)
- Source
- Intune Hydration Kit
- Subcategory
- Autopilot script package
- File path
- public/win32-apps/autopilot-branding.intunewin
What this template configures
15 configured properties. Nested values use dotted paths.
- packageIdentifier
- mtniehaus.AutopilotBranding
- packageUrl
- /win32-apps/autopilot-branding.intunewin
- packageFileName
- autopilot-branding.intunewin
- detectionScriptUrl
- /win32-apps/autopilot-branding/Detect-AutopilotBranding.ps1
- installScriptUrl
- /win32-apps/autopilot-branding/AutopilotBranding.ps1
- catalogSubcategory
- Autopilot script package
- publisher
- Michael Niehaus
- developer
- Michael Niehaus
- notes
- IntuneHydrationKitTemplateId: autopilot-branding Source: https://github.com/mtniehaus/AutopilotBranding AutopilotBrandingVersion: 4.0.7 License: MIT (c) Michael Niehaus Configuration: Intune Hydration Kit cleanup-only To apply your own branding, build a package at https://mtniehaus.github.io/AutopilotBranding/ and replace the app content. The commands and the detection rule stay the same.
- setupFilePath
- AutopilotBranding.ps1
- installCommandLine
- powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\AutopilotBranding.ps1
- uninstallCommandLine
- cmd.exe /c del %ProgramData%\Microsoft\AutopilotBranding\AutopilotBranding.ps1.tag
- minimumSupportedOperatingSystem.v10_21H1
- true
- applicableArchitectures
- x64
- allowAvailableUninstall
- false
Wrapper scripts
Detection script
# Intune detection script for the Autopilot Branding Win32 app.
# AutopilotBranding.ps1 writes this tag file each time it runs, also when it makes no change
# because the device has already completed OOBE.
$programData = if ([string]::IsNullOrWhiteSpace($env:ProgramData)) { 'C:\ProgramData' } else { $env:ProgramData }
$tagFile = Join-Path -Path $programData -ChildPath 'Microsoft\AutopilotBranding\AutopilotBranding.ps1.tag'
if (Test-Path -LiteralPath $tagFile -PathType Leaf) {
Write-Output "Autopilot Branding tag file found: $tagFile"
exit 0
}
exit 1
Install script
<#
.SYNOPSIS
Autopilot Branding runner script.
.DESCRIPTION
Loads the AutopilotBranding module from the AutopilotBranding folder next to this script and runs the configuration
in AutopilotBranding.json (also next to this script): each enabled task is called with its configured parameters,
and file and folder parameters refer to the Assets folder next to this script.
This script is the same for every configuration; change the configuration (AutopilotBranding.json) with
Show-AutopilotBrandingBuilder or the web builder instead of editing it.
.PARAMETER Force
Run the tasks even if OOBE has already been completed.
.PARAMETER LogFolder
Folder for the log (AutopilotBranding.log). Defaults to the usual location,
%ProgramData%\Microsoft\AutopilotBranding. A relative path is resolved against the current location. The tag file
used by the Intune detection rule is not affected (see -TagFile).
.PARAMETER TagFile
Full path of the tag file used by the Intune detection rule. Defaults to the usual location,
%ProgramData%\Microsoft\AutopilotBranding\AutopilotBranding.ps1.tag. A relative path is resolved against the current
location. If you change it, change the app's uninstall command and detection rule to match.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $false)] [Switch] $Force = $false,
[Parameter(Mandatory = $false)] [string] $LogFolder = "$($env:ProgramData)\Microsoft\AutopilotBranding",
[Parameter(Mandatory = $false)] [string] $TagFile = "$($env:ProgramData)\Microsoft\AutopilotBranding\AutopilotBranding.ps1.tag"
)
$LogFolder = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($LogFolder)
$TagFile = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($TagFile)
# If we are running as a 32-bit process on an x64 system, re-launch as a 64-bit process
if ("$env:PROCESSOR_ARCHITEW6432" -ne "ARM64") {
if (Test-Path "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe") {
$relaunchArgs = @('-ExecutionPolicy', 'Bypass', '-NoProfile', '-File', $PSCommandPath)
if ($Force) { $relaunchArgs += '-Force' }
$relaunchArgs += @('-LogFolder', $LogFolder, '-TagFile', $TagFile)
& "$($env:WINDIR)\SysNative\WindowsPowerShell\v1.0\powershell.exe" @relaunchArgs
exit $LASTEXITCODE
}
}
Import-Module (Join-Path $PSScriptRoot 'AutopilotBranding\AutopilotBranding.psd1') -Force
$startArgs = @{
Force = $Force
LogFolder = $LogFolder
TagFolder = Split-Path -Path $TagFile -Parent
TagFileName = Split-Path -Path $TagFile -Leaf
}
if (-not (Start-AutopilotBranding @startArgs)) {
exit 0
}
try {
Invoke-AutopilotBranding -ConfigPath (Join-Path $PSScriptRoot 'AutopilotBranding.json')
} finally {
Stop-AutopilotBranding
}
Uninstall script
cmd.exe /c del %ProgramData%\Microsoft\AutopilotBranding\AutopilotBranding.ps1.tagImport-ready JSON
Payload
{
"id": "autopilot-branding",
"packageIdentifier": "mtniehaus.AutopilotBranding",
"displayName": "Autopilot Branding (Cleanup) - [IHD]",
"packageUrl": "/win32-apps/autopilot-branding.intunewin",
"packageFileName": "autopilot-branding.intunewin",
"detectionScriptUrl": "/win32-apps/autopilot-branding/Detect-AutopilotBranding.ps1",
"installScriptUrl": "/win32-apps/autopilot-branding/AutopilotBranding.ps1",
"catalogSubcategory": "Autopilot script package",
"publisher": "Michael Niehaus",
"developer": "Michael Niehaus",
"owner": "",
"version": "4.0.7",
"description": "Autopilot Branding by Michael Niehaus, with a cleanup-only configuration. During Windows Autopilot (OOBE) it removes consumer in-box apps, hides Widgets, blocks the Copilot app and Dev Home from being installed, removes OEM Edge bookmarks and the Edge desktop shortcut, and updates Edge and the in-box apps. It sets no wallpaper, theme, Start layout, OEM information, language, or time zone, and installs no apps. On a device that has completed OOBE it makes no change. Assign it as a required app that blocks the Enrollment Status Page.",
"notes": "IntuneHydrationKitTemplateId: autopilot-branding\nSource: https://github.com/mtniehaus/AutopilotBranding\nAutopilotBrandingVersion: 4.0.7\nLicense: MIT (c) Michael Niehaus\nConfiguration: Intune Hydration Kit cleanup-only\nTo apply your own branding, build a package at https://mtniehaus.github.io/AutopilotBranding/ and replace the app content. The commands and the detection rule stay the same.",
"setupFilePath": "AutopilotBranding.ps1",
"installCommandLine": "powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\\AutopilotBranding.ps1",
"uninstallCommandLine": "cmd.exe /c del %ProgramData%\\Microsoft\\AutopilotBranding\\AutopilotBranding.ps1.tag",
"minimumSupportedOperatingSystem": {
"v10_21H1": true
},
"applicableArchitectures": "x64",
"allowAvailableUninstall": false,
"detectionScriptContent": "# Intune detection script for the Autopilot Branding Win32 app.\n# AutopilotBranding.ps1 writes this tag file each time it runs, also when it makes no change\n# because the device has already completed OOBE.\n$programData = if ([string]::IsNullOrWhiteSpace($env:ProgramData)) { 'C:\\ProgramData' } else { $env:ProgramData }\n$tagFile = Join-Path -Path $programData -ChildPath 'Microsoft\\AutopilotBranding\\AutopilotBranding.ps1.tag'\n\nif (Test-Path -LiteralPath $tagFile -PathType Leaf) {\n Write-Output \"Autopilot Branding tag file found: $tagFile\"\n exit 0\n}\n\nexit 1\n",
"installScriptContent": "<#\n.SYNOPSIS\nAutopilot Branding runner script.\n\n.DESCRIPTION\nLoads the AutopilotBranding module from the AutopilotBranding folder next to this script and runs the configuration\nin AutopilotBranding.json (also next to this script): each enabled task is called with its configured parameters,\nand file and folder parameters refer to the Assets folder next to this script.\n\nThis script is the same for every configuration; change the configuration (AutopilotBranding.json) with\nShow-AutopilotBrandingBuilder or the web builder instead of editing it.\n\n.PARAMETER Force\nRun the tasks even if OOBE has already been completed.\n\n.PARAMETER LogFolder\nFolder for the log (AutopilotBranding.log). Defaults to the usual location,\n%ProgramData%\\Microsoft\\AutopilotBranding. A relative path is resolved against the current location. The tag file\nused by the Intune detection rule is not affected (see -TagFile).\n\n.PARAMETER TagFile\nFull path of the tag file used by the Intune detection rule. Defaults to the usual location,\n%ProgramData%\\Microsoft\\AutopilotBranding\\AutopilotBranding.ps1.tag. A relative path is resolved against the current\nlocation. If you change it, change the app's uninstall command and detection rule to match.\n#>\n\n[CmdletBinding()]\nparam (\n\t[Parameter(Mandatory = $false)] [Switch] $Force = $false,\n\t[Parameter(Mandatory = $false)] [string] $LogFolder = \"$($env:ProgramData)\\Microsoft\\AutopilotBranding\",\n\t[Parameter(Mandatory = $false)] [string] $TagFile = \"$($env:ProgramData)\\Microsoft\\AutopilotBranding\\AutopilotBranding.ps1.tag\"\n)\n\n$LogFolder = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($LogFolder)\n$TagFile = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($TagFile)\n\n# If we are running as a 32-bit process on an x64 system, re-launch as a 64-bit process\nif (\"$env:PROCESSOR_ARCHITEW6432\" -ne \"ARM64\") {\n\tif (Test-Path \"$($env:WINDIR)\\SysNative\\WindowsPowerShell\\v1.0\\powershell.exe\") {\n\t\t$relaunchArgs = @('-ExecutionPolicy', 'Bypass', '-NoProfile', '-File', $PSCommandPath)\n\t\tif ($Force) { $relaunchArgs += '-Force' }\n\t\t$relaunchArgs += @('-LogFolder', $LogFolder, '-TagFile', $TagFile)\n\t\t& \"$($env:WINDIR)\\SysNative\\WindowsPowerShell\\v1.0\\powershell.exe\" @relaunchArgs\n\t\texit $LASTEXITCODE\n\t}\n}\n\nImport-Module (Join-Path $PSScriptRoot 'AutopilotBranding\\AutopilotBranding.psd1') -Force\n\n$startArgs = @{\n\tForce = $Force\n\tLogFolder = $LogFolder\n\tTagFolder = Split-Path -Path $TagFile -Parent\n\tTagFileName = Split-Path -Path $TagFile -Leaf\n}\nif (-not (Start-AutopilotBranding @startArgs)) {\n\texit 0\n}\n\ntry {\n\tInvoke-AutopilotBranding -ConfigPath (Join-Path $PSScriptRoot 'AutopilotBranding.json')\n} finally {\n\tStop-AutopilotBranding\n}\n",
"uninstallScriptContent": "cmd.exe /c del %ProgramData%\\Microsoft\\AutopilotBranding\\AutopilotBranding.ps1.tag"
}