Decrypt my World

Cryptography, Security, Debugging and more!

How to get the user running a VBScript

How to get the user running a VBScript

  • Comments 3

Hi all, welcome back,

It's very easy to find out the user name and the domain name of the user running a VBScript, and the computer name where it's running:

 

Set objNet = CreateObject("WScript.NetWork") 

strInfo = "User Name is     " & objNet.UserName & vbCRLF & _
          "Computer Name is " & objNet.ComputerName & vbCRLF & _
          "Domain Name is   " & objNet.UserDomain

MsgBox strInfo

 

I hope this helps.

Cheers,

 

Alex (Alejandro Campos Magencio)

  • Hi Alex,

    How could I get the domain name of a user account that I specify?

  • LookupAccountName API may help you here:

    http://msdn.microsoft.com/en-us/library/aa379159(VS.85).aspx

    Cheers,

    Alex

  • my e_mail:

    a26969@hotmail.com

    how can I write above data into a report or table fields.

    thanks.

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post
Translate This Page