Retired Microsoft Blog disclaimer

This directory is a mirror of retired "Decrypt My World" MSDN blog and is provided as is. All posting authorship and copyrights belong to respective authors.
Original URL: https://blogs.msdn.microsoft.com/alejacma/2008/03/11/how-to-get-the-user-running-a-vbscript/
Post name: How to get the user running a VBScript
Original author: Alejandro Campos Magencio
Posting date: 2008-03-11T03:07:00+00:00


Hi all, welcome back,


It's very easy to find out the user name andthe domain name of the user running a VBScript, and the computername 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)


Share this article:

Comments:

Comments are closed.