How to Get a Windows Username in Power Automate Desktop

Power Automate Desktop - Solutions

In this video I’ll be guiding you through two methods to dynamically retrieve the currently logged-in username on a Windows system using Power Automate Desktop. Why?! because you may be moving your RPA’s between users, machines or wherever and you may need to dynamically gather their username so that you can find the locations you’re storing files locally.

I’ll start with the Pro Code approach, where I’ll demonstrate the use of PowerShell scripting to gather it. You’ll learn how to leverage the $env variable in PowerShell, a powerful tool for accessing environment variables, including the username of the current user. This section is designed for those who enjoy a more technical challenge and showcases the versatility and power of PowerShell within Power Automate Desktop.

Following the Pro Code section, I’ll introduce you to the Low Code method. This approach is remarkably simpler, using an easy-to-follow action within Power Automate Desktop to achieve the same outcome. I designed this section for both beginners and those who prefer a more straightforward approach to automation. You’ll be surprised at how efficient and user-friendly this method is compared to the more complex Pro Code approach.

To wrap up the video, I’ll present a comparative analysis of both methods. This side-by-side comparison will not only highlight the functional differences but also reveal which method is faster.