You can query the username from the operating system. Depending on the environment, this may require certain entitlements. It also only gives you the name that the user gave to the OS, which might be something like AgentSmithMatrix42069.