Saturday, 2 October 2021

Detect autopilot session

 

Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requirement rule in Intune for the application.This ensure it'll only proceed when the PC is going through autopilot.

 

$username = "defaultuser0"
$currentuser = (Get-Process -IncludeUserName -Name explorer | Select-Object -ExpandProperty UserName).Split('\')[1]

if ($currentuser -eq $username)
{
    Write-Output 1
    Exit 0
}
else {
    exit 1
}

No comments:

Post a Comment

Detect autopilot session

  Ensuring that some apps only install during autopilot is not easily accomplished, you can use the below powershell script as a requiremen...