Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Get Remote Logged In logon list User
#DefineFunction udfGetRemoteLoggedInUser(computername, logonname, pswd) objLocator = ObjectCreate("WbemScripting.SWbemLocator") ErrorMode(@OFF) objService = objLocator.ConnectServer(computername,"root/cimv2",logonname,pswd) ErrorMode(@CANCEL) If objService == 0 Message("Error","Unable to connect to server") objLocator = 0 Exit EndIf objSecurity = objService.Security_ objSecurity.ImpersonationLevel = 3 class = "Win32_ComputerSystem" ; query instances query = "SELECT * FROM " : class colInstances = objService.ExecQuery(query) ForEach objInstance In colInstances type = ObjectTypeGet(objInstance) If type=="EMPTY" Then Return 0 ; obtain properties username = objinstance.UserName Next objSecurity = 0 objService = 0 objLocator = 0 Return username #EndFunction computername = "DELTA" logon = "TomThumb" pwd = "woodman" username = udfGetRemoteLoggedInUser(computername, logon, pwd) Message("RemoteLoggedInUser", username)
Article ID: W16230
File Created: 2007:02:21:08:17:28
Last Updated: 2007:02:21:08:17:28