Thursday, January 27, 2011

Find User Currently Logged In VBS

In VB Script the following code shows you which user is logged in:

Set WSHShell = CreateObject("WScript.Shell")
UserLoggedIn = WshShell.ExpandEnvironmentStrings("%username%")
wscript.echo UserLoggedIn


Very handy for logon scripts

2 comments: