[Take login username in windows - command line or vb.net solution]

I have encountered this problem for nearly 3 hours. Have been searching for all the possible solutions on various web pages but not working.

I need to find the login username of the current logging on user. It is the gray part of the below image
(レディンホアンソン)

This solution to this problem should be not dependent on the Windows version because my robot runs on many different types of Windows version ( > Windows 7 ), I think it should be command-line solution or vb.net code solution.

I have been searching for some solutions (vb.net + command line). But instead of my login username, it is the cC26038 OR MAIN.

Appreciate very much for any help. Thank you all

Hae you tried this @sonminator

system.Environment.UserName

or

system.Environment.UserDomainName

Hi @sonminator

You can use Get Environment Variable activity to get the username of that machine
image

1 Like

I have tried them all. The result is cC26038 and MAIN

I’ve just tried. The result is still cC26038 :frowning:

You need to write a piece of code to get the user display name. I don’t find any class or direct method to get that @sonminator

Try to google the same . you will get lot of solutions and even the code directly

1 Like

I have googled for 6 hours. Hope somebody has already encountered this problem unless it takes me more than 1 day to resolve this.

@sonminator

You need to invoke VB code to get name from registry

You can refer below workflow to get it
CheckNameFromRegistry.xaml (4.3 KB)

1 Like

You’re a genius. You saved my day ! . Appreciate very much :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.