Public/Test-Autopilot.ps1

function Test-Autopilot
{
    <#
        .DESCRIPTION
            Test if an Autopilot deployment is active
    
        .EXAMPLE
            $Autopilot = Test-Autopilot
    
        .NOTES
            Created by: Jon Anderson
            Modified: 2023-07-03
    #>

    $CurrentUser = (Get-WmiObject -Class Win32_ComputerSystem | Select-Object -ExpandProperty UserName).Split('\')
    if($CurrentUser[1] -eq "defaultuser0")
    {
        return $true
    }
    else
    {
        return $false
    }
}