Sat Jun 07, 2014 1:35 am
I added this to the appearance of the computer
[Logged_in_User()] Which is the following function
array_element(execute("cscript.exe",concatenate("//NoLogo C:\\ra\\whoisloggedon.vbs ",User_Pass()),"C:\\WINDOWS\\system32\\"),1)
whoisloggedon.vbs is the following script
'loggeduser.vbs
' Sample VBScript to discover which user is logged on
' Author Guy Thomas and John Eck
' Version 2.5 - December 2005
' -------------------------------------------------------'
'Modified by gsandul to logon to remote host using
'username and password specified from command line
'
'Set objPassword = CreateObject("ScriptPW.Password")
'strComputer = "192.168.0.60"
'You can uncomment the following 3 lines and
'specify hardcoded domain, username and password
strDomain = "xxx"
strUser = "xxxxxx"
strPassword = "xxxxxxx"
'wscript.echo wscript.arguments(0)
', wscript.arguments(1), wscript.arguments(2), wscript.arguments(3)
strComputer = wscript.arguments(0)
'If you hardcoded domain, username and password
'comment the following 3 lines
'strDomain = wscript.arguments(1)
'strUser = wscript.arguments(2)
'strPassword = wscript.arguments(3)
'wscript.echo strdomain, struser, strpassword
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, _
"root\CIMV2", _
strUser, _
strPassword, _
"MS_409", _
"NTLMDomain:" + strDomain)
' You suppose to be authentificated
' Now you can write any WMI function
Set colComputer = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
If not objComputer.UserName = "" Then
strLogonUser = Split(objComputer.UserName,"\")
strLogonUser(1) = UCase(Left(strLogonUser(1),1))& Trim(Mid(strLogonUser(1),2,20))
Wscript.Echo strLogonUser(1)
'Wscript.Echo strLogonUser(1) & " is logged on to " & strComputer
Else
Wscript.Echo "No_one_is_logged"
End If
Next
' End of Sample Logged on VBScript