$sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
osql -d AXDBDEV -p -E -Q "update userinfo set sid = '$sid', networkdomain =
'$env:userdomain', networkalias = '$env:username' where ID = 'admin'"
Microsoft Dynamics Ax developer's blog