Q:

Is it possible to check in VSTS was build stated manually or not? 

I'm trying to execute a bit different build steps in VSTS based on type how build was started: automatically or manually. 
I'm especially interested in accessing that information from powershell script.  But so far was not able to find suitable solution or workaround. 
Did someone faced similar requirement before?  How did you solved it?  I would appreciate your help! 

A:

It seems to be I've managed to find an option that allows to determine wherever build was triggered automatically or manually. 
All builds started manually have actual user in $Env:BUILD_QUEUEDBY variable, while automatic builds have system account there.  My value was [********]\Project Collection Service Accounts. 
I don't know how reliable it is, but for me so far following code did the job:
# Identifying who triggered the build
$OwnerId = $Env:BUILD_QUEUEDBY;
$OwnerId = $OwnerId. ToUpper();

if ($OwnerId. EndsWith("PROJECT COLLECTION SERVICE ACCOUNTS"))
{
    Write-Host "Build was triggered automatically.  Resulting files considered 'BETA'"
}
else
{
    Write-Host "Build was triggered manually.  Resulting files considered 'STABLE'"
}

