Tuesday, September 10

How to get system/user name of machine in QTP/VBscript

Hello Friends!

Here in this post we will quickly see how to get the User Name of the machine you are executing your test. It's useful specially in results of your test. If you have have more then one users/machines involved in the test execution, it'll help you to differentiate which tests have been executed on which machine.. 

Function f_GetSystemUserName()
    Set oSystemInfo = CreateObject("ADSystemInfo")
    Set oUser=GetObject("LDAP://" & oSystemInfo.UserName)
    f_GetSystemUserName= oUser.DisplayName
    Set oSystemInfo = Nothing
    Set oUser = Nothing
End Function    'End of function f_GetSystemUserName()

'Calling above function
Msgbox f_GetSystemUserName()


  1. Dim oNet, sUser
    Set oNet = CreateObject("WScript.Network")
    sUser = oNet.UserName
    loginUser = UCase(sUser)

  2. Amazing blog it is. I love reading blogs. I do not excite constantly by way of reading blog posts. But on your blog I in finding something that suggests in blogging. Anyway, you’re unquestionably an excellent blogger and you have got a talent to make your reader to hold reading your blog post again and again. Keep it up the very good work. Proceed moving the persons! This is likely one of the very exciting post. Due to the fact I’m new in blogging and that I require great educational pastime like your post.
    Visit: Best essay writing service

  3. Thanks for sharing amazing information !!!!!!
    Please keep up sharing.

  4. The worst part of it was that the software only worked intermittently and the data was not accurate. You obviously canot confront anyone about what you have discovered if the information is not right. מערכות גילוי אש

  5. Verified And Authentic Amazon SAA-C02 Dumps Pdf with Actual Amazon SAA-C02 Exam Questions and Answers. We are Offering 100% Exam Related Amazon SAA-C02 Exam Dumps.